stage3/datatype_functions.cc
author Mario de Sousa <msousa@fe.up.pt>
Fri, 26 Oct 2012 10:25:38 +0100
changeset 695 5760f1043ba4
parent 693 51a2fa6441b9
child 778 44e02a88f1e7
permissions -rw-r--r--
Code formating only.
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>
556
af3e378e98f9 Remove useless code, and replace with assertion.
mjsousa <msousa@fe.up.pt>
parents: 517
diff changeset
    28
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);
556
af3e378e98f9 Remove useless code, and replace with assertion.
mjsousa <msousa@fe.up.pt>
parents: 517
diff changeset
    40
  if (NULL == res)          ERROR;
434
c1278e52bcbc Move elementary_c::to_string() to datatype_functions.cc/hh
Mario de Sousa <msousa@fe.up.pt>
parents: 425
diff changeset
    41
  return res;
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
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
475
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
    48
/* Macro that expand to subtypes */
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
    49
/* 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
    50
#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
    51
#define __ANY_DERIVED(DO)
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
    52
#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
    53
#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
    54
#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
    55
#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
    56
//#define __ANY_STRING(DO)          DO(string) DO(wstring)
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
    57
#define __ANY_STRING(DO)          DO(string)
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
    58
#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
    59
#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
    60
#define __ANY_REAL(DO)            DO(real) DO(lreal)
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
    61
#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
    62
#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
    63
#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
    64
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
    65
#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
    66
#define __ANY_DERIVED_1(DO,P1)
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
    67
#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
    68
#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
    69
#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
    70
#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
    71
// #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
    72
#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
    73
#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
    74
#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
    75
#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
    76
#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
    77
#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
    78
#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
    79
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
    80
490
29f6ab0bf954 Add EXPT widen table.
Mario de Sousa <msousa@fe.up.pt>
parents: 484
diff changeset
    81
/**************************************************************/
29f6ab0bf954 Add EXPT widen table.
Mario de Sousa <msousa@fe.up.pt>
parents: 484
diff changeset
    82
/**************************************************************/
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
/*******  TABLE 24: Standard arithmetic functions       *******/
29f6ab0bf954 Add EXPT widen table.
Mario de Sousa <msousa@fe.up.pt>
parents: 484
diff changeset
    85
/*******    merged with                                 *******/
29f6ab0bf954 Add EXPT widen table.
Mario de Sousa <msousa@fe.up.pt>
parents: 484
diff changeset
    86
/*******  TABLE 30: Functions of time data types        *******/
29f6ab0bf954 Add EXPT widen table.
Mario de Sousa <msousa@fe.up.pt>
parents: 484
diff changeset
    87
/**************************************************************/
29f6ab0bf954 Add EXPT widen table.
Mario de Sousa <msousa@fe.up.pt>
parents: 484
diff changeset
    88
/**************************************************************/
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
517
889f4e577964 Remove deprecated status for ANYTIME operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 490
diff changeset
    91
/* NOTE: IEC 61131-3 v2 declares that using implicit operations ('+', '-', '*', '/') on ANYTIME data types is
889f4e577964 Remove deprecated status for ANYTIME operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 490
diff changeset
    92
 *       valid, but deprecated, suposedly meaning that they will be removed in the following version of the standard.
889f4e577964 Remove deprecated status for ANYTIME operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 490
diff changeset
    93
 *       However, the current draft version of IEC 61131-3 v3 still allows this use, and no longer declares these
889f4e577964 Remove deprecated status for ANYTIME operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 490
diff changeset
    94
 *       implicit operations as deprecated.
889f4e577964 Remove deprecated status for ANYTIME operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 490
diff changeset
    95
 *       Because of this, and although we are implementing v2 of the standard, we will no longer mark these 
889f4e577964 Remove deprecated status for ANYTIME operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 490
diff changeset
    96
 *       operations as deprecated.
889f4e577964 Remove deprecated status for ANYTIME operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 490
diff changeset
    97
 */
889f4e577964 Remove deprecated status for ANYTIME operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 490
diff changeset
    98
  #define ANYTIME_OPER_DEPRECATION_STATUS widen_entry::ok
889f4e577964 Remove deprecated status for ANYTIME operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 490
diff changeset
    99
//#define ANYTIME_OPER_DEPRECATION_STATUS widen_entry::deprecated
889f4e577964 Remove deprecated status for ANYTIME operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 490
diff changeset
   100
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
   101
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   102
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
   103
#define __add(TYPE)       \
693
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   104
    { &get_datatype_info_c::TYPE##_type_name,        &get_datatype_info_c::TYPE##_type_name,          &get_datatype_info_c::TYPE##_type_name,       widen_entry::ok                 }, \
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   105
    { &get_datatype_info_c::safe##TYPE##_type_name,  &get_datatype_info_c::TYPE##_type_name,          &get_datatype_info_c::TYPE##_type_name,       widen_entry::ok                 }, \
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   106
    { &get_datatype_info_c::TYPE##_type_name,        &get_datatype_info_c::safe##TYPE##_type_name,    &get_datatype_info_c::TYPE##_type_name,       widen_entry::ok                 }, \
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   107
    { &get_datatype_info_c::safe##TYPE##_type_name,  &get_datatype_info_c::safe##TYPE##_type_name,    &get_datatype_info_c::safe##TYPE##_type_name, widen_entry::ok                 },
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
   108
    __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
   109
#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
   110
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
    /*******************************************/
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
    /*******************************************/
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
    /*** 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
   114
    /*******************************************/
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
    /*******************************************/ 
693
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   116
    { &get_datatype_info_c::time_type_name,          &get_datatype_info_c::time_type_name,            &get_datatype_info_c::time_type_name,         widen_entry::ok                 },
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   117
    { &get_datatype_info_c::tod_type_name,           &get_datatype_info_c::time_type_name,            &get_datatype_info_c::tod_type_name,          ANYTIME_OPER_DEPRECATION_STATUS },
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   118
    /* NOTE: the standard des not explicitly support the following semantics. However, since 'addition' is supposed to be commutative, we add it anyway... */
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   119
    /* not currently supported by stage4, so it is best no tto add it for now... */
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   120
//  { &get_datatype_info_c::time_type_name,          &get_datatype_info_c::tod_type_name,             &get_datatype_info_c::tod_type_name,          ANYTIME_OPER_DEPRECATION_STATUS },
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   121
    { &get_datatype_info_c::dt_type_name,            &get_datatype_info_c::time_type_name,            &get_datatype_info_c::dt_type_name,           ANYTIME_OPER_DEPRECATION_STATUS },         
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   122
    /* NOTE: the standard des not explicitly support the following semantics. However, since 'addition' is supposed to be commutative, we add it anyway... */
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   123
    /* not currently supported by stage4, so it is best no tto add it for now... */
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   124
//  { &get_datatype_info_c::time_type_name,          &get_datatype_info_c::dt_type_name,              &get_datatype_info_c::dt_type_name,           ANYTIME_OPER_DEPRECATION_STATUS },         
474
85cacf5298fb Fix some 'widen' table entries.
Mario de Sousa <msousa@fe.up.pt>
parents: 468
diff changeset
   125
85cacf5298fb Fix some 'widen' table entries.
Mario de Sousa <msousa@fe.up.pt>
parents: 468
diff changeset
   126
    /*******************************/
85cacf5298fb Fix some 'widen' table entries.
Mario de Sousa <msousa@fe.up.pt>
parents: 468
diff changeset
   127
    /* SAFE version on the left... */
85cacf5298fb Fix some 'widen' table entries.
Mario de Sousa <msousa@fe.up.pt>
parents: 468
diff changeset
   128
    /*******************************/
693
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   129
    { &get_datatype_info_c::safetime_type_name,      &get_datatype_info_c::time_type_name,            &get_datatype_info_c::time_type_name,         widen_entry::ok                 },
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   130
    { &get_datatype_info_c::safetod_type_name,       &get_datatype_info_c::time_type_name,            &get_datatype_info_c::tod_type_name,          ANYTIME_OPER_DEPRECATION_STATUS },
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   131
    /* NOTE: the standard des not explicitly support the following semantics. However, since 'addition' is supposed to be commutative, we add it anyway... */
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   132
    /* not currently supported by stage4, so it is best no tto add it for now... */
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   133
//  { &get_datatype_info_c::safetime_type_name,      &get_datatype_info_c::tod_type_name,             &get_datatype_info_c::tod_type_name,          ANYTIME_OPER_DEPRECATION_STATUS },
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   134
    { &get_datatype_info_c::safedt_type_name,        &get_datatype_info_c::time_type_name,            &get_datatype_info_c::dt_type_name,           ANYTIME_OPER_DEPRECATION_STATUS },         
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   135
    /* NOTE: the standard des not explicitly support the following semantics. However, since 'addition' is supposed to be commutative, we add it anyway... */
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   136
    /* not currently supported by stage4, so it is best no tto add it for now... */
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   137
//  { &get_datatype_info_c::safetime_type_name,      &get_datatype_info_c::dt_type_name,              &get_datatype_info_c::dt_type_name,           ANYTIME_OPER_DEPRECATION_STATUS },         
474
85cacf5298fb Fix some 'widen' table entries.
Mario de Sousa <msousa@fe.up.pt>
parents: 468
diff changeset
   138
85cacf5298fb Fix some 'widen' table entries.
Mario de Sousa <msousa@fe.up.pt>
parents: 468
diff changeset
   139
    /********************************/
85cacf5298fb Fix some 'widen' table entries.
Mario de Sousa <msousa@fe.up.pt>
parents: 468
diff changeset
   140
    /* SAFE version on the right... */
85cacf5298fb Fix some 'widen' table entries.
Mario de Sousa <msousa@fe.up.pt>
parents: 468
diff changeset
   141
    /********************************/
693
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   142
    { &get_datatype_info_c::time_type_name,          &get_datatype_info_c::safetime_type_name,        &get_datatype_info_c::time_type_name,         widen_entry::ok         },
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   143
    { &get_datatype_info_c::tod_type_name,           &get_datatype_info_c::safetime_type_name,        &get_datatype_info_c::tod_type_name,          ANYTIME_OPER_DEPRECATION_STATUS },
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   144
    /* NOTE: the standard des not explicitly support the following semantics. However, since 'addition' is supposed to be commutative, we add it anyway... */
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   145
    /* not currently supported by stage4, so it is best no tto add it for now... */
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   146
//  { &get_datatype_info_c::time_type_name,          &get_datatype_info_c::safetod_type_name,         &get_datatype_info_c::tod_type_name,          ANYTIME_OPER_DEPRECATION_STATUS },
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   147
    { &get_datatype_info_c::dt_type_name,            &get_datatype_info_c::safetime_type_name,        &get_datatype_info_c::dt_type_name,           ANYTIME_OPER_DEPRECATION_STATUS },         
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   148
    /* NOTE: the standard des not explicitly support the following semantics. However, since 'addition' is supposed to be commutative, we add it anyway... */
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   149
    /* not currently supported by stage4, so it is best no tto add it for now... */
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   150
//  { &get_datatype_info_c::time_type_name,          &get_datatype_info_c::safedt_type_name,          &get_datatype_info_c::dt_type_name,           ANYTIME_OPER_DEPRECATION_STATUS },         
474
85cacf5298fb Fix some 'widen' table entries.
Mario de Sousa <msousa@fe.up.pt>
parents: 468
diff changeset
   151
85cacf5298fb Fix some 'widen' table entries.
Mario de Sousa <msousa@fe.up.pt>
parents: 468
diff changeset
   152
    /*************************************/
85cacf5298fb Fix some 'widen' table entries.
Mario de Sousa <msousa@fe.up.pt>
parents: 468
diff changeset
   153
    /* SAFE version on left and right... */
85cacf5298fb Fix some 'widen' table entries.
Mario de Sousa <msousa@fe.up.pt>
parents: 468
diff changeset
   154
    /*************************************/
693
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   155
    { &get_datatype_info_c::safetime_type_name,      &get_datatype_info_c::safetime_type_name,        &get_datatype_info_c::safetime_type_name,     widen_entry::ok                 },
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   156
    { &get_datatype_info_c::safetod_type_name,       &get_datatype_info_c::safetime_type_name,        &get_datatype_info_c::safetod_type_name,      ANYTIME_OPER_DEPRECATION_STATUS },
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   157
    /* NOTE: the standard des not explicitly support the following semantics. However, since 'addition' is supposed to be commutative, we add it anyway... */
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   158
    /* not currently supported by stage4, so it is best no tto add it for now... */
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   159
//  { &get_datatype_info_c::safetime_type_name,      &get_datatype_info_c::safetod_type_name,         &get_datatype_info_c::safetod_type_name,      ANYTIME_OPER_DEPRECATION_STATUS },
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   160
    { &get_datatype_info_c::safedt_type_name,        &get_datatype_info_c::safetime_type_name,        &get_datatype_info_c::safedt_type_name,       ANYTIME_OPER_DEPRECATION_STATUS },         
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   161
    /* NOTE: the standard des not explicitly support the following semantics. However, since 'addition' is supposed to be commutative, we add it anyway... */
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   162
    /* not currently supported by stage4, so it is best no tto add it for now... */
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   163
//  { &get_datatype_info_c::safetime_type_name,      &get_datatype_info_c::safedt_type_name,          &get_datatype_info_c::safedt_type_name,       ANYTIME_OPER_DEPRECATION_STATUS },
474
85cacf5298fb Fix some 'widen' table entries.
Mario de Sousa <msousa@fe.up.pt>
parents: 468
diff changeset
   164
   
458
587884880be6 iAdd warning for deprecated operations.
Conti Manuele <conti.ma@alice.it>
parents: 457
diff changeset
   165
    { 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
   166
};
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   167
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   168
474
85cacf5298fb Fix some 'widen' table entries.
Mario de Sousa <msousa@fe.up.pt>
parents: 468
diff changeset
   169
85cacf5298fb Fix some 'widen' table entries.
Mario de Sousa <msousa@fe.up.pt>
parents: 468
diff changeset
   170
475
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
   171
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
   172
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
   173
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
   174
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
   175
#define __sub(TYPE)       \
693
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   176
    { &get_datatype_info_c::TYPE##_type_name,        &get_datatype_info_c::TYPE##_type_name,          &get_datatype_info_c::TYPE##_type_name,       widen_entry::ok                 }, \
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   177
    { &get_datatype_info_c::safe##TYPE##_type_name,  &get_datatype_info_c::TYPE##_type_name,          &get_datatype_info_c::TYPE##_type_name,       widen_entry::ok                 }, \
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   178
    { &get_datatype_info_c::TYPE##_type_name,        &get_datatype_info_c::safe##TYPE##_type_name,    &get_datatype_info_c::TYPE##_type_name,       widen_entry::ok                 }, \
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   179
    { &get_datatype_info_c::safe##TYPE##_type_name,  &get_datatype_info_c::safe##TYPE##_type_name,    &get_datatype_info_c::safe##TYPE##_type_name, widen_entry::ok                 },
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
   180
    __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
   181
#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
   182
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   183
    /*******************************************/
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   184
    /*******************************************/
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   185
    /*** 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
   186
    /*******************************************/
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   187
    /*******************************************/ 
693
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   188
    { &get_datatype_info_c::time_type_name,          &get_datatype_info_c::time_type_name,            &get_datatype_info_c::time_type_name,         widen_entry::ok                 },
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   189
    { &get_datatype_info_c::date_type_name,          &get_datatype_info_c::date_type_name,            &get_datatype_info_c::time_type_name,         ANYTIME_OPER_DEPRECATION_STATUS },
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   190
    { &get_datatype_info_c::tod_type_name,           &get_datatype_info_c::time_type_name,            &get_datatype_info_c::tod_type_name,          ANYTIME_OPER_DEPRECATION_STATUS },
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   191
    { &get_datatype_info_c::tod_type_name,           &get_datatype_info_c::tod_type_name,             &get_datatype_info_c::time_type_name,         ANYTIME_OPER_DEPRECATION_STATUS },
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   192
    { &get_datatype_info_c::dt_type_name,            &get_datatype_info_c::time_type_name,            &get_datatype_info_c::dt_type_name,           ANYTIME_OPER_DEPRECATION_STATUS },
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   193
    { &get_datatype_info_c::dt_type_name,            &get_datatype_info_c::dt_type_name,              &get_datatype_info_c::time_type_name,         ANYTIME_OPER_DEPRECATION_STATUS },        
474
85cacf5298fb Fix some 'widen' table entries.
Mario de Sousa <msousa@fe.up.pt>
parents: 468
diff changeset
   194
85cacf5298fb Fix some 'widen' table entries.
Mario de Sousa <msousa@fe.up.pt>
parents: 468
diff changeset
   195
    /*******************************/
85cacf5298fb Fix some 'widen' table entries.
Mario de Sousa <msousa@fe.up.pt>
parents: 468
diff changeset
   196
    /* SAFE version on the left... */
85cacf5298fb Fix some 'widen' table entries.
Mario de Sousa <msousa@fe.up.pt>
parents: 468
diff changeset
   197
    /*******************************/
693
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   198
    { &get_datatype_info_c::safetime_type_name,      &get_datatype_info_c::time_type_name,            &get_datatype_info_c::time_type_name,         widen_entry::ok                 },
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   199
    { &get_datatype_info_c::safedate_type_name,      &get_datatype_info_c::date_type_name,            &get_datatype_info_c::time_type_name,         ANYTIME_OPER_DEPRECATION_STATUS },
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   200
    { &get_datatype_info_c::safetod_type_name,       &get_datatype_info_c::time_type_name,            &get_datatype_info_c::tod_type_name,          ANYTIME_OPER_DEPRECATION_STATUS },
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   201
    { &get_datatype_info_c::safetod_type_name,       &get_datatype_info_c::tod_type_name,             &get_datatype_info_c::time_type_name,         ANYTIME_OPER_DEPRECATION_STATUS },
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   202
    { &get_datatype_info_c::safedt_type_name,        &get_datatype_info_c::time_type_name,            &get_datatype_info_c::dt_type_name,           ANYTIME_OPER_DEPRECATION_STATUS },
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   203
    { &get_datatype_info_c::safedt_type_name,        &get_datatype_info_c::dt_type_name,              &get_datatype_info_c::time_type_name,         ANYTIME_OPER_DEPRECATION_STATUS },        
474
85cacf5298fb Fix some 'widen' table entries.
Mario de Sousa <msousa@fe.up.pt>
parents: 468
diff changeset
   204
85cacf5298fb Fix some 'widen' table entries.
Mario de Sousa <msousa@fe.up.pt>
parents: 468
diff changeset
   205
    /********************************/
85cacf5298fb Fix some 'widen' table entries.
Mario de Sousa <msousa@fe.up.pt>
parents: 468
diff changeset
   206
    /* SAFE version on the right... */
85cacf5298fb Fix some 'widen' table entries.
Mario de Sousa <msousa@fe.up.pt>
parents: 468
diff changeset
   207
    /********************************/
693
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   208
    { &get_datatype_info_c::time_type_name,          &get_datatype_info_c::safetime_type_name,        &get_datatype_info_c::time_type_name,         widen_entry::ok                 },
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   209
    { &get_datatype_info_c::date_type_name,          &get_datatype_info_c::safedate_type_name,        &get_datatype_info_c::time_type_name,         ANYTIME_OPER_DEPRECATION_STATUS },
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   210
    { &get_datatype_info_c::tod_type_name,           &get_datatype_info_c::safetime_type_name,        &get_datatype_info_c::tod_type_name,          ANYTIME_OPER_DEPRECATION_STATUS },
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   211
    { &get_datatype_info_c::tod_type_name,           &get_datatype_info_c::safetod_type_name,         &get_datatype_info_c::time_type_name,         ANYTIME_OPER_DEPRECATION_STATUS },
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   212
    { &get_datatype_info_c::dt_type_name,            &get_datatype_info_c::safetime_type_name,        &get_datatype_info_c::dt_type_name,           ANYTIME_OPER_DEPRECATION_STATUS },
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   213
    { &get_datatype_info_c::dt_type_name,            &get_datatype_info_c::safedt_type_name,          &get_datatype_info_c::time_type_name,         ANYTIME_OPER_DEPRECATION_STATUS },        
474
85cacf5298fb Fix some 'widen' table entries.
Mario de Sousa <msousa@fe.up.pt>
parents: 468
diff changeset
   214
85cacf5298fb Fix some 'widen' table entries.
Mario de Sousa <msousa@fe.up.pt>
parents: 468
diff changeset
   215
    /*************************************/
85cacf5298fb Fix some 'widen' table entries.
Mario de Sousa <msousa@fe.up.pt>
parents: 468
diff changeset
   216
    /* SAFE version on left and right... */
85cacf5298fb Fix some 'widen' table entries.
Mario de Sousa <msousa@fe.up.pt>
parents: 468
diff changeset
   217
    /*************************************/
693
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   218
    { &get_datatype_info_c::safetime_type_name,      &get_datatype_info_c::safetime_type_name,        &get_datatype_info_c::safetime_type_name,     widen_entry::ok                 },
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   219
    { &get_datatype_info_c::safedate_type_name,      &get_datatype_info_c::safedate_type_name,        &get_datatype_info_c::safetime_type_name,     ANYTIME_OPER_DEPRECATION_STATUS },
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   220
    { &get_datatype_info_c::safetod_type_name,       &get_datatype_info_c::safetime_type_name,        &get_datatype_info_c::safetod_type_name,      ANYTIME_OPER_DEPRECATION_STATUS },
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   221
    { &get_datatype_info_c::safetod_type_name,       &get_datatype_info_c::safetod_type_name,         &get_datatype_info_c::safetime_type_name,     ANYTIME_OPER_DEPRECATION_STATUS },
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   222
    { &get_datatype_info_c::safedt_type_name,        &get_datatype_info_c::safetime_type_name,        &get_datatype_info_c::safedt_type_name,       ANYTIME_OPER_DEPRECATION_STATUS },
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   223
    { &get_datatype_info_c::safedt_type_name,        &get_datatype_info_c::safedt_type_name,          &get_datatype_info_c::safetime_type_name,     ANYTIME_OPER_DEPRECATION_STATUS },        
474
85cacf5298fb Fix some 'widen' table entries.
Mario de Sousa <msousa@fe.up.pt>
parents: 468
diff changeset
   224
458
587884880be6 iAdd warning for deprecated operations.
Conti Manuele <conti.ma@alice.it>
parents: 457
diff changeset
   225
    { 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
   226
};
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   227
474
85cacf5298fb Fix some 'widen' table entries.
Mario de Sousa <msousa@fe.up.pt>
parents: 468
diff changeset
   228
85cacf5298fb Fix some 'widen' table entries.
Mario de Sousa <msousa@fe.up.pt>
parents: 468
diff changeset
   229
85cacf5298fb Fix some 'widen' table entries.
Mario de Sousa <msousa@fe.up.pt>
parents: 468
diff changeset
   230
85cacf5298fb Fix some 'widen' table entries.
Mario de Sousa <msousa@fe.up.pt>
parents: 468
diff changeset
   231
85cacf5298fb Fix some 'widen' table entries.
Mario de Sousa <msousa@fe.up.pt>
parents: 468
diff changeset
   232
85cacf5298fb Fix some 'widen' table entries.
Mario de Sousa <msousa@fe.up.pt>
parents: 468
diff changeset
   233
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
   234
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
   235
#define __mul(TYPE)       \
693
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   236
    { &get_datatype_info_c::TYPE##_type_name,        &get_datatype_info_c::TYPE##_type_name,          &get_datatype_info_c::TYPE##_type_name,       widen_entry::ok                 }, \
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   237
    { &get_datatype_info_c::safe##TYPE##_type_name,  &get_datatype_info_c::TYPE##_type_name,          &get_datatype_info_c::TYPE##_type_name,       widen_entry::ok                 }, \
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   238
    { &get_datatype_info_c::TYPE##_type_name,        &get_datatype_info_c::safe##TYPE##_type_name,    &get_datatype_info_c::TYPE##_type_name,       widen_entry::ok                 }, \
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   239
    { &get_datatype_info_c::safe##TYPE##_type_name,  &get_datatype_info_c::safe##TYPE##_type_name,    &get_datatype_info_c::safe##TYPE##_type_name, widen_entry::ok                 },
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
   240
    __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
   241
#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
   242
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
    /*******************************************/
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
    /*******************************************/
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   245
    /*** 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
   246
    /*******************************************/
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
    /*******************************************/ 
475
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
   248
#define __multime(TYPE)       \
693
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   249
    { &get_datatype_info_c::time_type_name,          &get_datatype_info_c::TYPE##_type_name,          &get_datatype_info_c::time_type_name,         ANYTIME_OPER_DEPRECATION_STATUS }, \
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   250
    { &get_datatype_info_c::safetime_type_name,      &get_datatype_info_c::TYPE##_type_name,          &get_datatype_info_c::time_type_name,         ANYTIME_OPER_DEPRECATION_STATUS }, \
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   251
    { &get_datatype_info_c::time_type_name,          &get_datatype_info_c::safe##TYPE##_type_name,    &get_datatype_info_c::time_type_name,         ANYTIME_OPER_DEPRECATION_STATUS }, \
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   252
    { &get_datatype_info_c::safetime_type_name,      &get_datatype_info_c::safe##TYPE##_type_name,    &get_datatype_info_c::safetime_type_name,     ANYTIME_OPER_DEPRECATION_STATUS }, \
480
8a58d7b8b26c Add MOD widening table, and some code clean-ups.
Mario de Sousa <msousa@fe.up.pt>
parents: 478
diff changeset
   253
    /* NOTE: the standard des not explicitly support the following semantics. However, since 'multiplication' is supposed to be commutative, we add it anyway... */                 \
693
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   254
    { &get_datatype_info_c::TYPE##_type_name,        &get_datatype_info_c::time_type_name,            &get_datatype_info_c::time_type_name,         ANYTIME_OPER_DEPRECATION_STATUS }, \
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   255
    { &get_datatype_info_c::safe##TYPE##_type_name,  &get_datatype_info_c::time_type_name,            &get_datatype_info_c::time_type_name,         ANYTIME_OPER_DEPRECATION_STATUS }, \
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   256
    { &get_datatype_info_c::TYPE##_type_name,        &get_datatype_info_c::safetime_type_name,        &get_datatype_info_c::time_type_name,         ANYTIME_OPER_DEPRECATION_STATUS }, \
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   257
    { &get_datatype_info_c::safe##TYPE##_type_name,  &get_datatype_info_c::safetime_type_name,        &get_datatype_info_c::safetime_type_name,     ANYTIME_OPER_DEPRECATION_STATUS },
475
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
   258
    __ANY_NUM(__multime)
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
   259
#undef __multime
458
587884880be6 iAdd warning for deprecated operations.
Conti Manuele <conti.ma@alice.it>
parents: 457
diff changeset
   260
587884880be6 iAdd warning for deprecated operations.
Conti Manuele <conti.ma@alice.it>
parents: 457
diff changeset
   261
    { 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
   262
};
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   263
475
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
   264
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
   265
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
   266
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
   267
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
   268
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
   269
#define __div(TYPE)       \
693
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   270
    { &get_datatype_info_c::TYPE##_type_name,        &get_datatype_info_c::TYPE##_type_name,          &get_datatype_info_c::TYPE##_type_name,       widen_entry::ok                 }, \
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   271
    { &get_datatype_info_c::safe##TYPE##_type_name,  &get_datatype_info_c::TYPE##_type_name,          &get_datatype_info_c::TYPE##_type_name,       widen_entry::ok                 }, \
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   272
    { &get_datatype_info_c::TYPE##_type_name,        &get_datatype_info_c::safe##TYPE##_type_name,    &get_datatype_info_c::TYPE##_type_name,       widen_entry::ok                 }, \
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   273
    { &get_datatype_info_c::safe##TYPE##_type_name,  &get_datatype_info_c::safe##TYPE##_type_name,    &get_datatype_info_c::safe##TYPE##_type_name, widen_entry::ok                 },
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
   274
    __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
   275
#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
   276
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
    /*******************************************/
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
    /*******************************************/
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   279
    /*** 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
   280
    /*******************************************/
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 475
diff changeset
   281
    /*******************************************/ 
475
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
   282
#define __divtime(TYPE)       \
693
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   283
    { &get_datatype_info_c::time_type_name,          &get_datatype_info_c::TYPE##_type_name,          &get_datatype_info_c::time_type_name,         ANYTIME_OPER_DEPRECATION_STATUS }, \
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   284
    { &get_datatype_info_c::safetime_type_name,      &get_datatype_info_c::TYPE##_type_name,          &get_datatype_info_c::time_type_name,         ANYTIME_OPER_DEPRECATION_STATUS }, \
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   285
    { &get_datatype_info_c::time_type_name,          &get_datatype_info_c::safe##TYPE##_type_name,    &get_datatype_info_c::time_type_name,         ANYTIME_OPER_DEPRECATION_STATUS }, \
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   286
    { &get_datatype_info_c::safetime_type_name,      &get_datatype_info_c::safe##TYPE##_type_name,    &get_datatype_info_c::safetime_type_name,     ANYTIME_OPER_DEPRECATION_STATUS },
475
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
   287
    __ANY_NUM(__divtime)
28816126cf8d Fix remaining 'widen' tables.
Mario de Sousa <msousa@fe.up.pt>
parents: 474
diff changeset
   288
#undef __divtime
458
587884880be6 iAdd warning for deprecated operations.
Conti Manuele <conti.ma@alice.it>
parents: 457
diff changeset
   289
587884880be6 iAdd warning for deprecated operations.
Conti Manuele <conti.ma@alice.it>
parents: 457
diff changeset
   290
    { NULL, NULL, NULL, widen_entry::ok },
587884880be6 iAdd warning for deprecated operations.
Conti Manuele <conti.ma@alice.it>
parents: 457
diff changeset
   291
 };
587884880be6 iAdd warning for deprecated operations.
Conti Manuele <conti.ma@alice.it>
parents: 457
diff changeset
   292
587884880be6 iAdd warning for deprecated operations.
Conti Manuele <conti.ma@alice.it>
parents: 457
diff changeset
   293
 
480
8a58d7b8b26c Add MOD widening table, and some code clean-ups.
Mario de Sousa <msousa@fe.up.pt>
parents: 478
diff changeset
   294
8a58d7b8b26c Add MOD widening table, and some code clean-ups.
Mario de Sousa <msousa@fe.up.pt>
parents: 478
diff changeset
   295
8a58d7b8b26c Add MOD widening table, and some code clean-ups.
Mario de Sousa <msousa@fe.up.pt>
parents: 478
diff changeset
   296
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
   297
#define __mod(TYPE)       \
693
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   298
    { &get_datatype_info_c::TYPE##_type_name,        &get_datatype_info_c::TYPE##_type_name,          &get_datatype_info_c::TYPE##_type_name,       widen_entry::ok                 }, \
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   299
    { &get_datatype_info_c::safe##TYPE##_type_name,  &get_datatype_info_c::TYPE##_type_name,          &get_datatype_info_c::TYPE##_type_name,       widen_entry::ok                 }, \
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   300
    { &get_datatype_info_c::TYPE##_type_name,        &get_datatype_info_c::safe##TYPE##_type_name,    &get_datatype_info_c::TYPE##_type_name,       widen_entry::ok                 }, \
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   301
    { &get_datatype_info_c::safe##TYPE##_type_name,  &get_datatype_info_c::safe##TYPE##_type_name,    &get_datatype_info_c::safe##TYPE##_type_name, widen_entry::ok                 },
480
8a58d7b8b26c Add MOD widening table, and some code clean-ups.
Mario de Sousa <msousa@fe.up.pt>
parents: 478
diff changeset
   302
    __ANY_NUM(__mod)
8a58d7b8b26c Add MOD widening table, and some code clean-ups.
Mario de Sousa <msousa@fe.up.pt>
parents: 478
diff changeset
   303
#undef __mod
8a58d7b8b26c Add MOD widening table, and some code clean-ups.
Mario de Sousa <msousa@fe.up.pt>
parents: 478
diff changeset
   304
8a58d7b8b26c Add MOD widening table, and some code clean-ups.
Mario de Sousa <msousa@fe.up.pt>
parents: 478
diff changeset
   305
    { 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
   306
};
8a58d7b8b26c Add MOD widening table, and some code clean-ups.
Mario de Sousa <msousa@fe.up.pt>
parents: 478
diff changeset
   307
 
8a58d7b8b26c Add MOD widening table, and some code clean-ups.
Mario de Sousa <msousa@fe.up.pt>
parents: 478
diff changeset
   308
 
481
16f943328696 Add 'widen' tables for AND, OR and XOR operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 480
diff changeset
   309
16f943328696 Add 'widen' tables for AND, OR and XOR operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 480
diff changeset
   310
490
29f6ab0bf954 Add EXPT widen table.
Mario de Sousa <msousa@fe.up.pt>
parents: 484
diff changeset
   311
const struct widen_entry widen_EXPT_table[] = {
29f6ab0bf954 Add EXPT widen table.
Mario de Sousa <msousa@fe.up.pt>
parents: 484
diff changeset
   312
#define __expt(IN2TYPE, IN1TYPE)       \
693
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   313
    { &get_datatype_info_c::IN1TYPE##_type_name,        &get_datatype_info_c::IN2TYPE##_type_name,          &get_datatype_info_c::IN1TYPE##_type_name,       widen_entry::ok        }, \
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   314
    { &get_datatype_info_c::safe##IN1TYPE##_type_name,  &get_datatype_info_c::IN2TYPE##_type_name,          &get_datatype_info_c::IN1TYPE##_type_name,       widen_entry::ok        }, \
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   315
    { &get_datatype_info_c::IN1TYPE##_type_name,        &get_datatype_info_c::safe##IN2TYPE##_type_name,    &get_datatype_info_c::IN1TYPE##_type_name,       widen_entry::ok        }, \
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   316
    { &get_datatype_info_c::safe##IN1TYPE##_type_name,  &get_datatype_info_c::safe##IN2TYPE##_type_name,    &get_datatype_info_c::safe##IN1TYPE##_type_name, widen_entry::ok        },
490
29f6ab0bf954 Add EXPT widen table.
Mario de Sousa <msousa@fe.up.pt>
parents: 484
diff changeset
   317
#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
   318
    __ANY_REAL(__IN2_anynum_)
29f6ab0bf954 Add EXPT widen table.
Mario de Sousa <msousa@fe.up.pt>
parents: 484
diff changeset
   319
#undef __expt
29f6ab0bf954 Add EXPT widen table.
Mario de Sousa <msousa@fe.up.pt>
parents: 484
diff changeset
   320
#undef __IN2_anynum_
29f6ab0bf954 Add EXPT widen table.
Mario de Sousa <msousa@fe.up.pt>
parents: 484
diff changeset
   321
    { NULL, NULL, NULL, widen_entry::ok },
29f6ab0bf954 Add EXPT widen table.
Mario de Sousa <msousa@fe.up.pt>
parents: 484
diff changeset
   322
};
29f6ab0bf954 Add EXPT widen table.
Mario de Sousa <msousa@fe.up.pt>
parents: 484
diff changeset
   323
29f6ab0bf954 Add EXPT widen table.
Mario de Sousa <msousa@fe.up.pt>
parents: 484
diff changeset
   324
29f6ab0bf954 Add EXPT widen table.
Mario de Sousa <msousa@fe.up.pt>
parents: 484
diff changeset
   325
481
16f943328696 Add 'widen' tables for AND, OR and XOR operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 480
diff changeset
   326
/**************************************************************/
16f943328696 Add 'widen' tables for AND, OR and XOR operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 480
diff changeset
   327
/**************************************************************/
16f943328696 Add 'widen' tables for AND, OR and XOR operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 480
diff changeset
   328
/**************************************************************/
16f943328696 Add 'widen' tables for AND, OR and XOR operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 480
diff changeset
   329
/*******                                                *******/
16f943328696 Add 'widen' tables for AND, OR and XOR operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 480
diff changeset
   330
/*******  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
   331
/*******                                                *******/
16f943328696 Add 'widen' tables for AND, OR and XOR operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 480
diff changeset
   332
/**************************************************************/
16f943328696 Add 'widen' tables for AND, OR and XOR operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 480
diff changeset
   333
/**************************************************************/
16f943328696 Add 'widen' tables for AND, OR and XOR operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 480
diff changeset
   334
/**************************************************************/
483
7f839fb100c1 Cleaning up XORN, ANDN, and ORN operator code.
Mario de Sousa <msousa@fe.up.pt>
parents: 481
diff changeset
   335
/* 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
   336
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
   337
#define __and(TYPE)       \
693
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   338
    { &get_datatype_info_c::TYPE##_type_name,        &get_datatype_info_c::TYPE##_type_name,          &get_datatype_info_c::TYPE##_type_name,       widen_entry::ok                 }, \
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   339
    { &get_datatype_info_c::safe##TYPE##_type_name,  &get_datatype_info_c::TYPE##_type_name,          &get_datatype_info_c::TYPE##_type_name,       widen_entry::ok                 }, \
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   340
    { &get_datatype_info_c::TYPE##_type_name,        &get_datatype_info_c::safe##TYPE##_type_name,    &get_datatype_info_c::TYPE##_type_name,       widen_entry::ok                 }, \
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   341
    { &get_datatype_info_c::safe##TYPE##_type_name,  &get_datatype_info_c::safe##TYPE##_type_name,    &get_datatype_info_c::safe##TYPE##_type_name, widen_entry::ok                 },
481
16f943328696 Add 'widen' tables for AND, OR and XOR operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 480
diff changeset
   342
    __ANY_BIT(__and)
16f943328696 Add 'widen' tables for AND, OR and XOR operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 480
diff changeset
   343
#undef __and
16f943328696 Add 'widen' tables for AND, OR and XOR operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 480
diff changeset
   344
16f943328696 Add 'widen' tables for AND, OR and XOR operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 480
diff changeset
   345
    { 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
   346
};
16f943328696 Add 'widen' tables for AND, OR and XOR operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 480
diff changeset
   347
483
7f839fb100c1 Cleaning up XORN, ANDN, and ORN operator code.
Mario de Sousa <msousa@fe.up.pt>
parents: 481
diff changeset
   348
/* 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
   349
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
   350
#define __or(TYPE)       \
693
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   351
    { &get_datatype_info_c::TYPE##_type_name,        &get_datatype_info_c::TYPE##_type_name,          &get_datatype_info_c::TYPE##_type_name,       widen_entry::ok                 }, \
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   352
    { &get_datatype_info_c::safe##TYPE##_type_name,  &get_datatype_info_c::TYPE##_type_name,          &get_datatype_info_c::TYPE##_type_name,       widen_entry::ok                 }, \
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   353
    { &get_datatype_info_c::TYPE##_type_name,        &get_datatype_info_c::safe##TYPE##_type_name,    &get_datatype_info_c::TYPE##_type_name,       widen_entry::ok                 }, \
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   354
    { &get_datatype_info_c::safe##TYPE##_type_name,  &get_datatype_info_c::safe##TYPE##_type_name,    &get_datatype_info_c::safe##TYPE##_type_name, widen_entry::ok                 },
481
16f943328696 Add 'widen' tables for AND, OR and XOR operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 480
diff changeset
   355
    __ANY_BIT(__or)
16f943328696 Add 'widen' tables for AND, OR and XOR operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 480
diff changeset
   356
#undef __or
16f943328696 Add 'widen' tables for AND, OR and XOR operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 480
diff changeset
   357
16f943328696 Add 'widen' tables for AND, OR and XOR operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 480
diff changeset
   358
    { 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
   359
};
16f943328696 Add 'widen' tables for AND, OR and XOR operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 480
diff changeset
   360
16f943328696 Add 'widen' tables for AND, OR and XOR operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 480
diff changeset
   361
483
7f839fb100c1 Cleaning up XORN, ANDN, and ORN operator code.
Mario de Sousa <msousa@fe.up.pt>
parents: 481
diff changeset
   362
/* 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
   363
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
   364
#define __xor(TYPE)       \
693
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   365
    { &get_datatype_info_c::TYPE##_type_name,        &get_datatype_info_c::TYPE##_type_name,          &get_datatype_info_c::TYPE##_type_name,       widen_entry::ok                 }, \
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   366
    { &get_datatype_info_c::safe##TYPE##_type_name,  &get_datatype_info_c::TYPE##_type_name,          &get_datatype_info_c::TYPE##_type_name,       widen_entry::ok                 }, \
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   367
    { &get_datatype_info_c::TYPE##_type_name,        &get_datatype_info_c::safe##TYPE##_type_name,    &get_datatype_info_c::TYPE##_type_name,       widen_entry::ok                 }, \
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   368
    { &get_datatype_info_c::safe##TYPE##_type_name,  &get_datatype_info_c::safe##TYPE##_type_name,    &get_datatype_info_c::safe##TYPE##_type_name, widen_entry::ok                 },
481
16f943328696 Add 'widen' tables for AND, OR and XOR operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 480
diff changeset
   369
    __ANY_BIT(__xor)
16f943328696 Add 'widen' tables for AND, OR and XOR operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 480
diff changeset
   370
#undef __xor
16f943328696 Add 'widen' tables for AND, OR and XOR operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 480
diff changeset
   371
16f943328696 Add 'widen' tables for AND, OR and XOR operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 480
diff changeset
   372
    { 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
   373
};
16f943328696 Add 'widen' tables for AND, OR and XOR operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 480
diff changeset
   374
484
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
/**************************************************************/
f78750994a82 Clean code for comparison operations & operators.
Mario de Sousa <msousa@fe.up.pt>
parents: 483
diff changeset
   377
/**************************************************************/
f78750994a82 Clean code for comparison operations & operators.
Mario de Sousa <msousa@fe.up.pt>
parents: 483
diff changeset
   378
/*******                                                *******/
f78750994a82 Clean code for comparison operations & operators.
Mario de Sousa <msousa@fe.up.pt>
parents: 483
diff changeset
   379
/*******  TABLE 28: Standard comparison functions       *******/
f78750994a82 Clean code for comparison operations & operators.
Mario de Sousa <msousa@fe.up.pt>
parents: 483
diff changeset
   380
/*******                                                *******/
f78750994a82 Clean code for comparison operations & operators.
Mario de Sousa <msousa@fe.up.pt>
parents: 483
diff changeset
   381
/**************************************************************/
f78750994a82 Clean code for comparison operations & operators.
Mario de Sousa <msousa@fe.up.pt>
parents: 483
diff changeset
   382
/**************************************************************/
f78750994a82 Clean code for comparison operations & operators.
Mario de Sousa <msousa@fe.up.pt>
parents: 483
diff changeset
   383
/**************************************************************/
f78750994a82 Clean code for comparison operations & operators.
Mario de Sousa <msousa@fe.up.pt>
parents: 483
diff changeset
   384
/* 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
   385
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
   386
#define __cmp(TYPE)       \
693
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   387
    { &get_datatype_info_c::TYPE##_type_name,        &get_datatype_info_c::TYPE##_type_name,          &get_datatype_info_c::bool_type_name,         widen_entry::ok                 }, \
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   388
    { &get_datatype_info_c::safe##TYPE##_type_name,  &get_datatype_info_c::TYPE##_type_name,          &get_datatype_info_c::bool_type_name,         widen_entry::ok                 }, \
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   389
    { &get_datatype_info_c::TYPE##_type_name,        &get_datatype_info_c::safe##TYPE##_type_name,    &get_datatype_info_c::bool_type_name,         widen_entry::ok                 }, \
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
   390
    { &get_datatype_info_c::safe##TYPE##_type_name,  &get_datatype_info_c::safe##TYPE##_type_name,    &get_datatype_info_c::safebool_type_name,     widen_entry::ok                 },
484
f78750994a82 Clean code for comparison operations & operators.
Mario de Sousa <msousa@fe.up.pt>
parents: 483
diff changeset
   391
    __ANY_ELEMENTARY(__cmp)
f78750994a82 Clean code for comparison operations & operators.
Mario de Sousa <msousa@fe.up.pt>
parents: 483
diff changeset
   392
#undef __cmp
f78750994a82 Clean code for comparison operations & operators.
Mario de Sousa <msousa@fe.up.pt>
parents: 483
diff changeset
   393
f78750994a82 Clean code for comparison operations & operators.
Mario de Sousa <msousa@fe.up.pt>
parents: 483
diff changeset
   394
    { NULL, NULL, NULL, widen_entry::ok },
f78750994a82 Clean code for comparison operations & operators.
Mario de Sousa <msousa@fe.up.pt>
parents: 483
diff changeset
   395
};
481
16f943328696 Add 'widen' tables for AND, OR and XOR operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 480
diff changeset
   396
16f943328696 Add 'widen' tables for AND, OR and XOR operations.
Mario de Sousa <msousa@fe.up.pt>
parents: 480
diff changeset
   397
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
   398
/* 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
   399
 * 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
   400
 */
606
d2122a32ec86 Cleaning up the code.
Mario de Sousa <msousa@fe.up.pt>
parents: 603
diff changeset
   401
int search_in_candidate_datatype_list(symbol_c *datatype, const 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
   402
	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
   403
		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
   404
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
   405
	for(unsigned int i = 0; i < candidate_datatypes.size(); i++)
676
ca4f17211251 Move is_datatype_valid/equal() to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
   406
		if (get_datatype_info_c::is_type_equal(datatype, candidate_datatypes[i]))
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
   407
			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
   408
	/* 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
   409
	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
   410
}
c8e6cf57324a Print error messages when datatype erros found in ST function/FB calls.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
   411
603
a45a62dd6df9 Add remove_from_candidate_datatype_list method using constant_folding results.
Manuele Conti <conti.ma@alice.it>
parents: 556
diff changeset
   412
/* Remove a datatype inside a candidate_datatypes list.
a45a62dd6df9 Add remove_from_candidate_datatype_list method using constant_folding results.
Manuele Conti <conti.ma@alice.it>
parents: 556
diff changeset
   413
 * Returns: If successful it returns true, false otherwise.
a45a62dd6df9 Add remove_from_candidate_datatype_list method using constant_folding results.
Manuele Conti <conti.ma@alice.it>
parents: 556
diff changeset
   414
 */
a45a62dd6df9 Add remove_from_candidate_datatype_list method using constant_folding results.
Manuele Conti <conti.ma@alice.it>
parents: 556
diff changeset
   415
bool remove_from_candidate_datatype_list(symbol_c *datatype, std::vector <symbol_c *> &candidate_datatypes) {
606
d2122a32ec86 Cleaning up the code.
Mario de Sousa <msousa@fe.up.pt>
parents: 603
diff changeset
   416
	int pos = search_in_candidate_datatype_list(datatype, candidate_datatypes);
d2122a32ec86 Cleaning up the code.
Mario de Sousa <msousa@fe.up.pt>
parents: 603
diff changeset
   417
	if (pos < 0)
603
a45a62dd6df9 Add remove_from_candidate_datatype_list method using constant_folding results.
Manuele Conti <conti.ma@alice.it>
parents: 556
diff changeset
   418
		return false;
606
d2122a32ec86 Cleaning up the code.
Mario de Sousa <msousa@fe.up.pt>
parents: 603
diff changeset
   419
	
d2122a32ec86 Cleaning up the code.
Mario de Sousa <msousa@fe.up.pt>
parents: 603
diff changeset
   420
	candidate_datatypes.erase(candidate_datatypes.begin() + pos);
d2122a32ec86 Cleaning up the code.
Mario de Sousa <msousa@fe.up.pt>
parents: 603
diff changeset
   421
	return true;
603
a45a62dd6df9 Add remove_from_candidate_datatype_list method using constant_folding results.
Manuele Conti <conti.ma@alice.it>
parents: 556
diff changeset
   422
}
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
   423
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
   424
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
   425
457
67d8b07bac22 Change prev_il_instruction to a vector<>
Mario de Sousa <msousa@fe.up.pt>
parents: 447
diff changeset
   426
/* Intersect two candidate_datatype_lists.
67d8b07bac22 Change prev_il_instruction to a vector<>
Mario de Sousa <msousa@fe.up.pt>
parents: 447
diff changeset
   427
 * 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
   428
 * 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
   429
 * 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
   430
 */
67d8b07bac22 Change prev_il_instruction to a vector<>
Mario de Sousa <msousa@fe.up.pt>
parents: 447
diff changeset
   431
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
   432
	if ((NULL == list1) || (NULL == list2))
67d8b07bac22 Change prev_il_instruction to a vector<>
Mario de Sousa <msousa@fe.up.pt>
parents: 447
diff changeset
   433
		/* 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
   434
		return;
67d8b07bac22 Change prev_il_instruction to a vector<>
Mario de Sousa <msousa@fe.up.pt>
parents: 447
diff changeset
   435
67d8b07bac22 Change prev_il_instruction to a vector<>
Mario de Sousa <msousa@fe.up.pt>
parents: 447
diff changeset
   436
	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
   437
		/* 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
   438
		 * 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
   439
		 */
67d8b07bac22 Change prev_il_instruction to a vector<>
Mario de Sousa <msousa@fe.up.pt>
parents: 447
diff changeset
   440
		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
   441
			/* 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
   442
			list1->candidate_datatypes.erase(i);
67d8b07bac22 Change prev_il_instruction to a vector<>
Mario de Sousa <msousa@fe.up.pt>
parents: 447
diff changeset
   443
		else i++;
67d8b07bac22 Change prev_il_instruction to a vector<>
Mario de Sousa <msousa@fe.up.pt>
parents: 447
diff changeset
   444
	}
67d8b07bac22 Change prev_il_instruction to a vector<>
Mario de Sousa <msousa@fe.up.pt>
parents: 447
diff changeset
   445
}
67d8b07bac22 Change prev_il_instruction to a vector<>
Mario de Sousa <msousa@fe.up.pt>
parents: 447
diff changeset
   446
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
   447
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
   448
458
587884880be6 iAdd warning for deprecated operations.
Conti Manuele <conti.ma@alice.it>
parents: 457
diff changeset
   449
459
01f6664bf8c5 Continue adding support for semantic verification of JMP and RET.
Mario de Sousa <msousa@fe.up.pt>
parents: 458
diff changeset
   450
/* 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
   451
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
   452
	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
   453
		return;
01f6664bf8c5 Continue adding support for semantic verification of JMP and RET.
Mario de Sousa <msousa@fe.up.pt>
parents: 458
diff changeset
   454
	
468
46f8154d506e Delete unecessary copy_candidate_datatype_list() function.
Mario de Sousa <msousa@fe.up.pt>
parents: 467
diff changeset
   455
	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
   456
	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
   457
		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
   458
	}  
01f6664bf8c5 Continue adding support for semantic verification of JMP and RET.
Mario de Sousa <msousa@fe.up.pt>
parents: 458
diff changeset
   459
}
01f6664bf8c5 Continue adding support for semantic verification of JMP and RET.
Mario de Sousa <msousa@fe.up.pt>
parents: 458
diff changeset
   460
01f6664bf8c5 Continue adding support for semantic verification of JMP and RET.
Mario de Sousa <msousa@fe.up.pt>
parents: 458
diff changeset
   461
01f6664bf8c5 Continue adding support for semantic verification of JMP and RET.
Mario de Sousa <msousa@fe.up.pt>
parents: 458
diff changeset
   462
01f6664bf8c5 Continue adding support for semantic verification of JMP and RET.
Mario de Sousa <msousa@fe.up.pt>
parents: 458
diff changeset
   463
436
f9fd63f64f5c Delete un-used code.
Mario de Sousa <msousa@fe.up.pt>
parents: 435
diff changeset
   464
f9fd63f64f5c Delete un-used code.
Mario de Sousa <msousa@fe.up.pt>
parents: 435
diff changeset
   465
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
   466