absyntax_utils/get_datatype_info.cc
author mjsousa
Sun, 15 Feb 2015 16:07:29 +0000
changeset 994 66dc2ef40e70
parent 987 562b67922966
child 1016 91bef6704b44
permissions -rw-r--r--
Fix bug introduced in 2014/10/19, while adding support for REF() opertors -> datatype checking was not catching datatype inconsistency errors!
666
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
     1
/*
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
     2
 *  matiec - a compiler for the programming languages defined in IEC 61131-3
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
     3
 *
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
     4
 *  Copyright (C) 2003-2012  Mario de Sousa (msousa@fe.up.pt)
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
     5
 *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
676
ca4f17211251 Move is_datatype_valid/equal() to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 668
diff changeset
     6
 *  Copyright (C) 2012       Manuele Conti  (conti.ma@alice.it)
666
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
     7
 *
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
     8
 *  This program is free software: you can redistribute it and/or modify
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
     9
 *  it under the terms of the GNU General Public License as published by
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    10
 *  the Free Software Foundation, either version 3 of the License, or
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    11
 *  (at your option) any later version.
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    12
 *
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    13
 *  This program is distributed in the hope that it will be useful,
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    14
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    15
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    16
 *  GNU General Public License for more details.
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    17
 *
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    18
 *  You should have received a copy of the GNU General Public License
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    19
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    20
 *
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    21
 *
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    22
 * This code is made available on the understanding that it will not be
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    23
 * used in safety-critical situations without a full and competent review.
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    24
 */
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    25
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    26
/*
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    27
 * An IEC 61131-3 compiler.
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    28
 *
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    29
 * Based on the
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    30
 * FINAL DRAFT - IEC 61131-3, 2nd Ed. (2001-12-10)
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    31
 *
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    32
 */
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    33
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    34
/* Determine the characteristics of a specific data type
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    35
 *  e.g., is it an enumeration, is it an array, is it ANY_INT, etc...
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    36
 *
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    37
 * The methods of this class may be passed either:
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    38
 *  - a data type declaration symbol_c, 
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    39
 *   OR
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    40
 *  - the name of a data type (identifier_c)
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    41
 *    In this case, we shall first serach for the basetype declaration using search_base_type_c, and then 
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    42
 *    run the normal process.
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    43
 */
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    44
#include "absyntax_utils.hh"
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    45
946
c012a64dc2fa Make the relaxed datatype model a runtime option (off by default)
mjsousa
parents: 945
diff changeset
    46
#include "../main.hh" // required for ERROR() and ERROR_MSG() macros, as well as the runtime_options global variable
666
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    47
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    48
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    49
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    50
#include <typeinfo>  // required for typeid
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    51
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    52
727
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
    53
/**********************************************************/
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
    54
/**********************************************************/
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
    55
/**********************************************************/
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
    56
/*****                                                *****/
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
    57
/*****                                                *****/
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
    58
/*****           Some helper classes                  *****/
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
    59
/*****                                                *****/
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
    60
/*****                                                *****/
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
    61
/**********************************************************/
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
    62
/**********************************************************/
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
    63
/**********************************************************/
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
    64
938
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
    65
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
    66
/****************************************************************************************************/
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
    67
/****************************************************************************************************/
727
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
    68
/* Return the identifier (name) of a datatype, typically declared in a TYPE .. END_TYPE declaration */
938
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
    69
/****************************************************************************************************/
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
    70
/****************************************************************************************************/
727
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
    71
class get_datatype_id_c: null_visitor_c {
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
    72
  private:
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
    73
    static get_datatype_id_c *singleton;
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
    74
    
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
    75
  public:
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
    76
    static symbol_c *get_id(symbol_c *symbol) {
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
    77
      if (NULL == singleton) singleton = new  get_datatype_id_c();
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
    78
      if (NULL == singleton) ERROR;
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
    79
      return (symbol_c *)symbol->accept(*singleton);
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
    80
    }
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
    81
    
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
    82
  protected:
929
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
    83
    /***********************************/
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
    84
    /* B 1.3.1 - Elementary Data Types */
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
    85
    /***********************************/
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
    86
    void *visit(time_type_name_c        *symbol) {return (void *)symbol;};
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
    87
    void *visit(bool_type_name_c        *symbol) {return (void *)symbol;};
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
    88
    void *visit(sint_type_name_c        *symbol) {return (void *)symbol;};
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
    89
    void *visit(int_type_name_c         *symbol) {return (void *)symbol;};
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
    90
    void *visit(dint_type_name_c        *symbol) {return (void *)symbol;};
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
    91
    void *visit(lint_type_name_c        *symbol) {return (void *)symbol;};
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
    92
    void *visit(usint_type_name_c       *symbol) {return (void *)symbol;};
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
    93
    void *visit(uint_type_name_c        *symbol) {return (void *)symbol;};
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
    94
    void *visit(udint_type_name_c       *symbol) {return (void *)symbol;};
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
    95
    void *visit(ulint_type_name_c       *symbol) {return (void *)symbol;};
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
    96
    void *visit(real_type_name_c        *symbol) {return (void *)symbol;};
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
    97
    void *visit(lreal_type_name_c       *symbol) {return (void *)symbol;};
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
    98
    void *visit(date_type_name_c        *symbol) {return (void *)symbol;};
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
    99
    void *visit(tod_type_name_c         *symbol) {return (void *)symbol;};
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   100
    void *visit(dt_type_name_c          *symbol) {return (void *)symbol;};
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   101
    void *visit(byte_type_name_c        *symbol) {return (void *)symbol;};
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   102
    void *visit(word_type_name_c        *symbol) {return (void *)symbol;};
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   103
    void *visit(lword_type_name_c       *symbol) {return (void *)symbol;};
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   104
    void *visit(dword_type_name_c       *symbol) {return (void *)symbol;};
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   105
    void *visit(string_type_name_c      *symbol) {return (void *)symbol;};
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   106
    void *visit(wstring_type_name_c     *symbol) {return (void *)symbol;};
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   107
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   108
    void *visit(safetime_type_name_c    *symbol) {return (void *)symbol;};
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   109
    void *visit(safebool_type_name_c    *symbol) {return (void *)symbol;};
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   110
    void *visit(safesint_type_name_c    *symbol) {return (void *)symbol;};
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   111
    void *visit(safeint_type_name_c     *symbol) {return (void *)symbol;};
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   112
    void *visit(safedint_type_name_c    *symbol) {return (void *)symbol;};
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   113
    void *visit(safelint_type_name_c    *symbol) {return (void *)symbol;};
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   114
    void *visit(safeusint_type_name_c   *symbol) {return (void *)symbol;};
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   115
    void *visit(safeuint_type_name_c    *symbol) {return (void *)symbol;};
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   116
    void *visit(safeudint_type_name_c   *symbol) {return (void *)symbol;};
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   117
    void *visit(safeulint_type_name_c   *symbol) {return (void *)symbol;};
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   118
    void *visit(safereal_type_name_c    *symbol) {return (void *)symbol;};
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   119
    void *visit(safelreal_type_name_c   *symbol) {return (void *)symbol;};
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   120
    void *visit(safedate_type_name_c    *symbol) {return (void *)symbol;};
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   121
    void *visit(safetod_type_name_c     *symbol) {return (void *)symbol;};
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   122
    void *visit(safedt_type_name_c      *symbol) {return (void *)symbol;};
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   123
    void *visit(safebyte_type_name_c    *symbol) {return (void *)symbol;};
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   124
    void *visit(safeword_type_name_c    *symbol) {return (void *)symbol;};
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   125
    void *visit(safelword_type_name_c   *symbol) {return (void *)symbol;};
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   126
    void *visit(safedword_type_name_c   *symbol) {return (void *)symbol;};
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   127
    void *visit(safestring_type_name_c  *symbol) {return (void *)symbol;};
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   128
    void *visit(safewstring_type_name_c *symbol) {return (void *)symbol;};
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   129
727
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
   130
    /********************************/
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
   131
    /* B 1.3.3 - Derived data types */
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
   132
    /********************************/
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
   133
    /*  simple_type_name ':' simple_spec_init */
909
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   134
    void *visit(simple_type_declaration_c     *symbol)  {return symbol->simple_type_name;}
727
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
   135
    /*  subrange_type_name ':' subrange_spec_init */
909
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   136
    void *visit(subrange_type_declaration_c   *symbol)  {return symbol->subrange_type_name;}
727
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
   137
    /*  enumerated_type_name ':' enumerated_spec_init */
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
   138
    void *visit(enumerated_type_declaration_c *symbol)  {return symbol->enumerated_type_name;}
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
   139
    /*  identifier ':' array_spec_init */
909
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   140
    void *visit(array_type_declaration_c      *symbol)  {return symbol->identifier;}
727
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
   141
    /*  structure_type_name ':' structure_specification */
909
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   142
    void *visit(structure_type_declaration_c  *symbol)  {return symbol->structure_type_name;}
727
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
   143
    /*  string_type_name ':' elementary_string_type_name string_type_declaration_size string_type_declaration_init */
909
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   144
    void *visit(string_type_declaration_c     *symbol)  {return symbol->string_type_name;}
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   145
    /* ref_type_decl: identifier ':' ref_spec_init */
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   146
    void *visit(ref_type_decl_c               *symbol)  {return symbol->ref_type_name;}
929
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   147
    /* NOTE: DO NOT place any code here that references symbol->anotations_map["generate_c_annotaton__implicit_type_id"] !!
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   148
     *       All anotations in the symbol->anotations_map[] are considered a stage4 construct. In the above example,
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   149
     *       That anotation is specific to the generate_c stage4 code, and must therefore NOT be referenced
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   150
     *       in the absyntax_utils code, as this last code should be independent of the stage4 version!
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   151
     */ 
958
7474d2cd1d6e Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents: 946
diff changeset
   152
727
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
   153
    /*****************************/
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
   154
    /* B 1.5.2 - Function Blocks */
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
   155
    /*****************************/
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
   156
    /*  FUNCTION_BLOCK derived_function_block_name io_OR_other_var_declarations function_block_body END_FUNCTION_BLOCK */
909
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   157
    void *visit(function_block_declaration_c  *symbol)  {return symbol->fblock_name;}
958
7474d2cd1d6e Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents: 946
diff changeset
   158
    /**********************/
7474d2cd1d6e Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents: 946
diff changeset
   159
    /* B 1.5.3 - Programs */
7474d2cd1d6e Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents: 946
diff changeset
   160
    /**********************/
7474d2cd1d6e Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents: 946
diff changeset
   161
    /*  PROGRAM program_type_name program_var_declarations_list function_block_body END_PROGRAM */
7474d2cd1d6e Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents: 946
diff changeset
   162
    void *visit(program_declaration_c  *symbol)  {return symbol->program_type_name;}
7474d2cd1d6e Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents: 946
diff changeset
   163
    
727
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
   164
}; // get_datatype_id_c 
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
   165
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
   166
get_datatype_id_c *get_datatype_id_c::singleton = NULL;
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
   167
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
   168
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
   169
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
   170
938
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   171
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   172
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   173
/**************************************************/
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   174
/**************************************************/
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   175
/* transform elementary data type class to string */
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   176
/**************************************************/
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   177
/**************************************************/
778
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   178
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   179
/* A small helper class, to transform elementary data type to string.
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   180
 * this allows us to generate more relevant error messages...
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   181
 */
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   182
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   183
class get_datatype_id_str_c: public null_visitor_c {
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   184
  protected:
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   185
     get_datatype_id_str_c(void)  {};
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   186
    ~get_datatype_id_str_c(void) {};
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   187
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   188
  private:
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   189
    /* singleton class! */
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   190
    static get_datatype_id_str_c *singleton;
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   191
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   192
  public:
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   193
    static const char *get_id_str(symbol_c *symbol) {
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   194
      if (NULL == singleton)    singleton = new get_datatype_id_str_c;
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   195
      if (NULL == singleton)    ERROR;
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   196
      const char *res           = (const char *)symbol->accept(*singleton);
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   197
      if (NULL == res)          ERROR;
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   198
      return res;
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   199
    }
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   200
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   201
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   202
    /*************************/
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   203
    /* B.1 - Common elements */
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   204
    /*************************/
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   205
    /*******************************************/
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   206
    /* B 1.1 - Letters, digits and identifiers */
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   207
    /*******************************************/
945
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   208
    void *visit(                 identifier_c *symbol) {return (void *)symbol->value;};
958
7474d2cd1d6e Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents: 946
diff changeset
   209
    // Should not be necessary, as datatype declarations currently use an identifier_c for their name! 
7474d2cd1d6e Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents: 946
diff changeset
   210
    // Only references to the datatype (when declaring variable, for ex., will use poutype_identifier_c
7474d2cd1d6e Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents: 946
diff changeset
   211
    void *visit(derived_datatype_identifier_c *symbol) {return (void *)symbol->value;};   
7474d2cd1d6e Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents: 946
diff changeset
   212
    // Should not be necessary, as FB declarations currently use an identifier_c for their name! 
7474d2cd1d6e Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents: 946
diff changeset
   213
    // Only references to the FB (when declaring variable, for ex., will use poutype_identifier_c
7474d2cd1d6e Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents: 946
diff changeset
   214
    void *visit(         poutype_identifier_c *symbol) {return (void *)symbol->value;};  
778
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   215
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   216
    /***********************************/
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   217
    /* B 1.3.1 - Elementary Data Types */
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   218
    /***********************************/
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   219
    void *visit(time_type_name_c        *symbol) {return (void *)"TIME";        };
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   220
    void *visit(bool_type_name_c        *symbol) {return (void *)"BOOL";        };
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   221
    void *visit(sint_type_name_c        *symbol) {return (void *)"SINT";        };
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   222
    void *visit(int_type_name_c         *symbol) {return (void *)"INT";         };
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   223
    void *visit(dint_type_name_c        *symbol) {return (void *)"DINT";        };
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   224
    void *visit(lint_type_name_c        *symbol) {return (void *)"LINT";        };
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   225
    void *visit(usint_type_name_c       *symbol) {return (void *)"USINT";       };
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   226
    void *visit(uint_type_name_c        *symbol) {return (void *)"UINT";        };
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   227
    void *visit(udint_type_name_c       *symbol) {return (void *)"UDINT";       };
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   228
    void *visit(ulint_type_name_c       *symbol) {return (void *)"ULINT";       };
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   229
    void *visit(real_type_name_c        *symbol) {return (void *)"REAL";        };
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   230
    void *visit(lreal_type_name_c       *symbol) {return (void *)"LREAL";       };
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   231
    void *visit(date_type_name_c        *symbol) {return (void *)"DATE";        };
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   232
    void *visit(tod_type_name_c         *symbol) {return (void *)"TOD";         };
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   233
    void *visit(dt_type_name_c          *symbol) {return (void *)"DT";          };
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   234
    void *visit(byte_type_name_c        *symbol) {return (void *)"BYTE";        };
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   235
    void *visit(word_type_name_c        *symbol) {return (void *)"WORD";        };
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   236
    void *visit(lword_type_name_c       *symbol) {return (void *)"LWORD";       };
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   237
    void *visit(dword_type_name_c       *symbol) {return (void *)"DWORD";       };
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   238
    void *visit(string_type_name_c      *symbol) {return (void *)"STRING";      };
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   239
    void *visit(wstring_type_name_c     *symbol) {return (void *)"WSTRING";     };
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   240
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   241
    void *visit(safetime_type_name_c    *symbol) {return (void *)"SAFETIME";    };
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   242
    void *visit(safebool_type_name_c    *symbol) {return (void *)"SAFEBOOL";    };
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   243
    void *visit(safesint_type_name_c    *symbol) {return (void *)"SAFESINT";    };
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   244
    void *visit(safeint_type_name_c     *symbol) {return (void *)"SAFEINT";     };
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   245
    void *visit(safedint_type_name_c    *symbol) {return (void *)"SAFEDINT";    };
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   246
    void *visit(safelint_type_name_c    *symbol) {return (void *)"SAFELINT";    };
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   247
    void *visit(safeusint_type_name_c   *symbol) {return (void *)"SAFEUSINT";   };
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   248
    void *visit(safeuint_type_name_c    *symbol) {return (void *)"SAFEUINT";    };
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   249
    void *visit(safeudint_type_name_c   *symbol) {return (void *)"SAFEUDINT";   };
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   250
    void *visit(safeulint_type_name_c   *symbol) {return (void *)"SAFEULINT";   };
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   251
    void *visit(safereal_type_name_c    *symbol) {return (void *)"SAFEREAL";    };
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   252
    void *visit(safelreal_type_name_c   *symbol) {return (void *)"SAFELREAL";   };
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   253
    void *visit(safedate_type_name_c    *symbol) {return (void *)"SAFEDATE";    };
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   254
    void *visit(safetod_type_name_c     *symbol) {return (void *)"SAFETOD";     };
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   255
    void *visit(safedt_type_name_c      *symbol) {return (void *)"SAFEDT";      };
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   256
    void *visit(safebyte_type_name_c    *symbol) {return (void *)"SAFEBYTE";    };
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   257
    void *visit(safeword_type_name_c    *symbol) {return (void *)"SAFEWORD";    };
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   258
    void *visit(safelword_type_name_c   *symbol) {return (void *)"SAFELWORD";   };
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   259
    void *visit(safedword_type_name_c   *symbol) {return (void *)"SAFEDWORD";   };
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   260
    void *visit(safestring_type_name_c  *symbol) {return (void *)"SAFESTRING";  };
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   261
    void *visit(safewstring_type_name_c *symbol) {return (void *)"SAFEWSTRING"; };
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   262
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   263
    /********************************/
945
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   264
    /* B.1.3.2 - Generic data types */
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   265
    /********************************/
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   266
    void *visit(generic_type_any_c *symbol) {return (void *)"ANY"; };
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   267
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   268
    /********************************/
778
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   269
    /* B 1.3.3 - Derived data types */
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   270
    /********************************/
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   271
    /*  simple_type_name ':' simple_spec_init */
909
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   272
    void *visit(simple_type_declaration_c     *symbol)  {return symbol->simple_type_name->accept(*this);}
778
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   273
    /*  subrange_type_name ':' subrange_spec_init */
909
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   274
    void *visit(subrange_type_declaration_c   *symbol)  {return symbol->subrange_type_name->accept(*this);}
778
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   275
    /*  enumerated_type_name ':' enumerated_spec_init */
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   276
    void *visit(enumerated_type_declaration_c *symbol)  {return symbol->enumerated_type_name->accept(*this);}
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   277
    /*  identifier ':' array_spec_init */
909
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   278
    void *visit(array_type_declaration_c      *symbol)  {return symbol->identifier->accept(*this);}
778
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   279
    /*  structure_type_name ':' structure_specification */
909
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   280
    void *visit(structure_type_declaration_c  *symbol)  {return symbol->structure_type_name->accept(*this);}
778
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   281
    /*  string_type_name ':' elementary_string_type_name string_type_declaration_size string_type_declaration_init */
909
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   282
    void *visit(string_type_declaration_c     *symbol)  {return symbol->string_type_name->accept(*this);}
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   283
    /* ref_type_decl: identifier ':' ref_spec_init */
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   284
    void *visit(ref_type_decl_c               *symbol)  {return symbol->ref_type_name->accept(*this);}
929
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   285
    /* NOTE: DO NOT place any code here that references symbol->anotations_map["generate_c_annotaton__implicit_type_id"] !!
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   286
     *       All anotations in the symbol->anotations_map[] are considered a stage4 construct. In the above example,
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   287
     *       That anotation is specific to the generate_c stage4 code, and must therefore NOT be referenced
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   288
     *       in the absyntax_utils code, as this last code should be independent of the stage4 version!
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   289
     */ 
778
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   290
    
958
7474d2cd1d6e Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents: 946
diff changeset
   291
    /***********************/
7474d2cd1d6e Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents: 946
diff changeset
   292
    /* B 1.5.1 - Functions */
7474d2cd1d6e Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents: 946
diff changeset
   293
    /***********************/
7474d2cd1d6e Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents: 946
diff changeset
   294
    /* Functions are not really datatypes, but we include it here as it helps in printing out error messages!   */
7474d2cd1d6e Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents: 946
diff changeset
   295
    /* Currently this is needed only by remove_forward_depencies_c::print_circ_error()                          */
7474d2cd1d6e Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents: 946
diff changeset
   296
    /*  FUNCTION derived_function_name ':' elementary_type_name io_OR_function_var_declarations_list function_body END_FUNCTION */
7474d2cd1d6e Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents: 946
diff changeset
   297
    void *visit(      function_declaration_c  *symbol)  {return symbol->derived_function_name->accept(*this);}
778
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   298
    /*****************************/
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   299
    /* B 1.5.2 - Function Blocks */
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   300
    /*****************************/
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   301
    /*  FUNCTION_BLOCK derived_function_block_name io_OR_other_var_declarations function_block_body END_FUNCTION_BLOCK */
909
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   302
    void *visit(function_block_declaration_c  *symbol)  {return symbol->fblock_name->accept(*this);}    
958
7474d2cd1d6e Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents: 946
diff changeset
   303
    /**********************/
7474d2cd1d6e Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents: 946
diff changeset
   304
    /* B 1.5.3 - Programs */
7474d2cd1d6e Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents: 946
diff changeset
   305
    /**********************/
7474d2cd1d6e Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents: 946
diff changeset
   306
    /*  PROGRAM program_type_name program_var_declarations_list function_block_body END_PROGRAM */
7474d2cd1d6e Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents: 946
diff changeset
   307
    void *visit(       program_declaration_c  *symbol)  {return symbol->program_type_name->accept(*this);} 
778
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   308
};
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   309
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   310
get_datatype_id_str_c *get_datatype_id_str_c::singleton = NULL;
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   311
727
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
   312
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
   313
938
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   314
/*********************************************************/
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   315
/*********************************************************/
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   316
/* get the datatype of a field inside a struct data type */
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   317
/*********************************************************/
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   318
/*********************************************************/
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   319
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   320
class get_struct_info_c : null_visitor_c {
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   321
  private:
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   322
    symbol_c *current_field;
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   323
    /* singleton class! */
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   324
    static get_struct_info_c *singleton;
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   325
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   326
  public:
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   327
    get_struct_info_c(void) {current_field = NULL;}
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   328
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   329
    static symbol_c *get_field_type_id(symbol_c *struct_type, symbol_c *field_name) {
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   330
      if (NULL == singleton)    singleton = new get_struct_info_c;
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   331
      if (NULL == singleton)    ERROR;
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   332
      singleton->current_field = field_name;
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   333
      return (symbol_c *)struct_type->accept(*singleton);
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   334
    }
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   335
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   336
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   337
  private:
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   338
    /*************************/
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   339
    /* B.1 - Common elements */
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   340
    /*************************/
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   341
    /********************************/
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   342
    /* B 1.3.3 - Derived data types */
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   343
    /********************************/
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   344
    /*  structure_type_name ':' structure_specification */
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   345
    /* NOTE: this is only used inside a TYPE ... END_TYPE declaration.  It is never used directly when declaring a new variable! */
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   346
    /* NOTE: structure_specification will point to either initialized_structure_c  OR  structure_element_declaration_list_c */
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   347
    void *visit(structure_type_declaration_c *symbol) {return symbol->structure_specification->accept(*this);}
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   348
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   349
    /* structure_type_name ASSIGN structure_initialization */
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   350
    /* structure_initialization may be NULL ! */
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   351
    // SYM_REF2(initialized_structure_c, structure_type_name, structure_initialization)
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   352
    /* NOTE: only the initialized structure is never used when declaring a new variable instance */
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   353
    void *visit(initialized_structure_c *symbol) {return symbol->structure_type_name->accept(*this);}
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   354
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   355
    /* helper symbol for structure_declaration */
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   356
    /* structure_declaration:  STRUCT structure_element_declaration_list END_STRUCT */
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   357
    /* structure_element_declaration_list structure_element_declaration ';' */
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   358
    void *visit(structure_element_declaration_list_c *symbol) {
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   359
      /* now search the structure declaration */
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   360
      for(int i = 0; i < symbol->n; i++) {
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   361
        void *tmp = symbol->elements[i]->accept(*this);
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   362
        if (NULL != tmp) return tmp;
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   363
      }
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   364
      return NULL; // not found!!
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   365
    }  
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   366
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   367
    /*  structure_element_name ':' spec_init */
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   368
    void *visit(structure_element_declaration_c *symbol) {
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   369
      if (compare_identifiers(symbol->structure_element_name, current_field) == 0)
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   370
        return symbol->spec_init; /* found the type of the element we were looking for! */
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   371
      return NULL;   /* not the element we are looking for! */
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   372
    }
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   373
      
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   374
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   375
    /* helper symbol for structure_initialization */
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   376
    /* structure_initialization: '(' structure_element_initialization_list ')' */
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   377
    /* structure_element_initialization_list ',' structure_element_initialization */
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   378
    void *visit(structure_element_initialization_list_c *symbol) {ERROR; return NULL;} /* should never get called... */
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   379
    /*  structure_element_name ASSIGN value */
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   380
    void *visit(structure_element_initialization_c *symbol) {ERROR; return NULL;} /* should never get called... */
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   381
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   382
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   383
    /**************************************/
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   384
    /* B.1.5 - Program organization units */
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   385
    /**************************************/
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   386
    /*****************************/
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   387
    /* B 1.5.2 - Function Blocks */
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   388
    /*****************************/
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   389
    /*  FUNCTION_BLOCK derived_function_block_name io_OR_other_var_declarations function_block_body END_FUNCTION_BLOCK */
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   390
    // SYM_REF4(function_block_declaration_c, fblock_name, var_declarations, fblock_body, unused)
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   391
    void *visit(function_block_declaration_c *symbol) {
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   392
      /* now search the function block declaration for the variable... */
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   393
      search_var_instance_decl_c search_decl(symbol);
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   394
      return search_decl.get_decl(current_field);
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   395
    }
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   396
      
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   397
    /*********************************************/
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   398
    /* B.1.6  Sequential function chart elements */
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   399
    /*********************************************/
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   400
    /* INITIAL_STEP step_name ':' action_association_list END_STEP */
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   401
    // SYM_REF2(initial_step_c, step_name, action_association_list)
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   402
    void *visit(initial_step_c *symbol) {
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   403
      identifier_c T("T");  identifier_c X("X");
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   404
      /* Hard code the datatypes of the implicit variables Stepname.X and Stepname.T */
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   405
      if (compare_identifiers(&T, current_field) == 0)  return &get_datatype_info_c::time_type_name;
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   406
      if (compare_identifiers(&X, current_field) == 0)  return &get_datatype_info_c::bool_type_name;
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   407
      return NULL;
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   408
    }
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   409
      
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   410
    /* STEP step_name ':' action_association_list END_STEP */
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   411
    // SYM_REF2(step_c, step_name, action_association_list)
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   412
    /* The code here should be identicial to the code in the visit(initial_step_c *) visitor! So we simply call the other visitor! */
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   413
    void *visit(step_c *symbol) {initial_step_c initial_step(NULL, NULL); return initial_step.accept(*this);}
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   414
      
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   415
}; // get_struct_info_c
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   416
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   417
get_struct_info_c *get_struct_info_c::singleton = NULL;
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   418
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   419
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   420
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   421
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   422
727
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
   423
/**********************************************************/
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
   424
/**********************************************************/
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
   425
/**********************************************************/
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
   426
/*****                                                *****/
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
   427
/*****                                                *****/
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
   428
/*****        GET_DATATYPE_INFO_C                     *****/
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
   429
/*****                                                *****/
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
   430
/*****                                                *****/
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
   431
/**********************************************************/
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
   432
/**********************************************************/
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
   433
/**********************************************************/
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
   434
778
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   435
const char *get_datatype_info_c::get_id_str(symbol_c *datatype) {
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   436
  return get_datatype_id_str_c::get_id_str(datatype);
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   437
}
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   438
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   439
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   440
symbol_c *get_datatype_info_c::get_id(symbol_c *datatype) {
727
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
   441
  return get_datatype_id_c::get_id(datatype);
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
   442
}
666
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   443
676
ca4f17211251 Move is_datatype_valid/equal() to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 668
diff changeset
   444
938
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   445
symbol_c *get_datatype_info_c::get_struct_field_type_id(symbol_c *struct_datatype, symbol_c *struct_fieldname) {
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   446
  return get_struct_info_c::get_field_type_id(struct_datatype, struct_fieldname);
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   447
}
31e3b3f2eff1 Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
mjsousa
parents: 929
diff changeset
   448
945
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   449
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   450
939
5074236fb3c4 fill_candidate_datatypes_c now uses search_varinstance_decl_c instead of search_varfb_instance_type_c (moving towards deprecation of search_varfb_instance_type_c)
mjsousa
parents: 938
diff changeset
   451
symbol_c *get_datatype_info_c::get_array_storedtype_id(symbol_c *type_symbol) {
5074236fb3c4 fill_candidate_datatypes_c now uses search_varinstance_decl_c instead of search_varfb_instance_type_c (moving towards deprecation of search_varfb_instance_type_c)
mjsousa
parents: 938
diff changeset
   452
  // returns the datatype of the variables stored in the array
945
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   453
  array_specification_c *symbol = NULL;
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   454
  if (NULL == symbol)  symbol = dynamic_cast<array_specification_c *>(type_symbol);
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   455
  if (NULL == symbol)  symbol = dynamic_cast<array_specification_c *>(search_base_type_c::get_basetype_decl(type_symbol));
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   456
  if (NULL != symbol)  
939
5074236fb3c4 fill_candidate_datatypes_c now uses search_varinstance_decl_c instead of search_varfb_instance_type_c (moving towards deprecation of search_varfb_instance_type_c)
mjsousa
parents: 938
diff changeset
   457
    return symbol->non_generic_type_name;
5074236fb3c4 fill_candidate_datatypes_c now uses search_varinstance_decl_c instead of search_varfb_instance_type_c (moving towards deprecation of search_varfb_instance_type_c)
mjsousa
parents: 938
diff changeset
   458
  return NULL; // this is not an array!
5074236fb3c4 fill_candidate_datatypes_c now uses search_varinstance_decl_c instead of search_varfb_instance_type_c (moving towards deprecation of search_varfb_instance_type_c)
mjsousa
parents: 938
diff changeset
   459
}
5074236fb3c4 fill_candidate_datatypes_c now uses search_varinstance_decl_c instead of search_varfb_instance_type_c (moving towards deprecation of search_varfb_instance_type_c)
mjsousa
parents: 938
diff changeset
   460
  
5074236fb3c4 fill_candidate_datatypes_c now uses search_varinstance_decl_c instead of search_varfb_instance_type_c (moving towards deprecation of search_varfb_instance_type_c)
mjsousa
parents: 938
diff changeset
   461
  
945
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   462
  
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   463
922
1ba7a814098d Update some comments. (No changes to code)
mjsousa
parents: 921
diff changeset
   464
/* Returns true if both datatypes are equivalent (not necessarily equal!).
1ba7a814098d Update some comments. (No changes to code)
mjsousa
parents: 921
diff changeset
   465
 * WARNING: May return true even though the datatypes are not the same/identicial!!!
1ba7a814098d Update some comments. (No changes to code)
mjsousa
parents: 921
diff changeset
   466
 *          This occurs when at least one of the datatypes is of a generic
1ba7a814098d Update some comments. (No changes to code)
mjsousa
parents: 921
diff changeset
   467
 *          datatype (or a REF_TO a generic datatype). 
1ba7a814098d Update some comments. (No changes to code)
mjsousa
parents: 921
diff changeset
   468
 *          (Generic dataypes: ANY, ANY_INT, ANY_NUM, ...)
1ba7a814098d Update some comments. (No changes to code)
mjsousa
parents: 921
diff changeset
   469
 * NOTE: Currently only the ANY generic datatype is implemented!
1ba7a814098d Update some comments. (No changes to code)
mjsousa
parents: 921
diff changeset
   470
 * NOTE: Currently stage1_2 only allows the use of the ANY keyword when in conjuntion with
1ba7a814098d Update some comments. (No changes to code)
mjsousa
parents: 921
diff changeset
   471
 *       the REF_TO keyword (i.e. REF_TO ANY), so when handling non REF_TO datatypes,
1ba7a814098d Update some comments. (No changes to code)
mjsousa
parents: 921
diff changeset
   472
 *       this function will currently only return true if the dataypes are identicial.
921
d228aaa4d616 Introduce absyntax class for keyword ANY, and use REF_TO(ANY) as datatype of NULL literal.
mjsousa
parents: 919
diff changeset
   473
 */
929
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   474
945
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   475
/* NOTE: matiec supports a strict and a relaxed data type model. Which datatype model to use is chosen
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   476
 *       as a command line option.
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   477
 * 
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   478
 * 
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   479
 *       The Strict Datatype Model
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   480
 *       =========================
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   481
 *       The strict datatype model used by matiec considers any implicitly defined datatype
929
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   482
 *       (e.g. an array datatype defined in the variable declaration itself, instead of inside a TYPE ... END_TYPE
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   483
 *       construct) to be different (i.e. not the same datatype, and therefore not compatible) to any other
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   484
 *       datatype, including with datatypes declared identically to the implicit datatype.
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   485
 *       e.g.
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   486
 *         TYPE my_array_t: ARRAY [1..3] OF INT; END_TYPE;
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   487
 *         FUNCTION_BLOCK FOO
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   488
 *          VAR my_array:  ARRAY [1..3] OF INT; END_VAR
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   489
 *         ...
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   490
 *         END_FUNCTION_BLOCK
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   491
 * 
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   492
 *         In the abive code, my_array is NOT considered to te compatible with my_Array_t !!!
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   493
 * 
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   494
 *       In essence, the currently supported datatype model considers all datatypes to be different to each other,
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   495
 *       even though the stored data is the same (Let us call this rule (0))!
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   496
 *       There are 2 exceptions to the above rule:
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   497
 *        (1) Datatypes that are directly derived from other datatypes.
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   498
 *              (this rule is specified in the standard, so we follow it!)
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   499
 *        (2) REF_TO datatypes that reference the same datatype
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   500
 *              (I dont think the standard says anything about this!)
945
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   501
 *              (This rule should actually be part of the relaxed datatype model, but for now we
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   502
 *               will leave it in the strict datatype model) 
929
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   503
 *
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   504
 *         TYPE 
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   505
 *          my_array_1_t: ARRAY [1..3] OF INT; 
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   506
 *          my_array_2_t: ARRAY [1..3] OF INT; 
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   507
 *          my_array_3_t: my_array_1_t; 
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   508
 *          A_ref_t: REF_TO my_array_1_t;
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   509
 *          B_ref_t: REF_TO my_array_1_t;
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   510
 *          C_ref_t: A_ref_t;
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   511
 *         END_TYPE;
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   512
 *                 
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   513
 *         In the above code, my_array_1_t is a distinct datatype to my_array_2_t
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   514
 *           (this is different to C and C++, where they would be considered the same datatype!)
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   515
 *           (following rule (0))
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   516
 *         In the above code, my_array_3_t is the same datatype as my_array_1_t
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   517
 *           (following rule (1))
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   518
 *         In the above code, A_ref_t is the same datatype as B_ref_t
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   519
 *           (following rule (2))
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   520
 *         In the above code, A_ref_t is the same datatype as C_ref_t
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   521
 *           (following rule (1))
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   522
 *
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   523
 *       Note that rule (0) means that a function/FB with a parameter whose datatype is implicitly defined
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   524
 *       can never be passed a value!
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   525
 *         FUNCTION_BLOCK FOO
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   526
 *          VAR_INPUT my_array:  ARRAY [1..3] OF INT; END_VAR
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   527
 *         ...
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   528
 *         END_FUNCTION_BLOCK
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   529
 *
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   530
 *       Any call to FB foo can never pass a value to parameter my_array, as its datatype is distinct
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   531
 *       to all other datatypes, and therefore passing any other variable to my_array will result in an
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   532
 *       'incompatible datatypes' error!
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   533
 *       The above seems natural o me (Mario) in a programming language that is very strongly typed.
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   534
 * 
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   535
 *       However, if we did not have exception (2), the following would also be invalid:
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   536
 *         TYPE my_array_t: ARRAY [1..3] OF INT; END_TYPE;
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   537
 *         FUNCTION_BLOCK FOO_t
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   538
 *          VAR_INPUT my_array: REF_TO my_array_t; END_VAR
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   539
 *         ...
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   540
 *         END_FUNCTION_BLOCK
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   541
 * 
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   542
 *         FUNCTION_BLOCK BAR
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   543
 *          VAR
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   544
 *            my_array: my_array_t; 
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   545
 *            foo: FOO_t;
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   546
 *          END_VAR
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   547
 *          foo(REF(my_array));  <----- invalid, without rule 2!!
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   548
 *         ...
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   549
 *         END_FUNCTION_BLOCK
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   550
 * 
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   551
 *       Rule/exception (2) goes against the datatype model used for all other datatypes.
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   552
 *       This rule was adopted as without it, the datatype of the value returned by the REF() 
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   553
 *       operator would be considered distinct to all other datatypes, and therefore the
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   554
 *       REF() operator would be essentially useless.
945
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   555
 * 
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   556
 * 
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   557
 *       The Relaxed Datatype Model
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   558
 *       ==========================
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   559
 *       In the relaxed datatype model, the same rules as the strict datatype model are followed, with the
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   560
 *       exception of implicitly defined array datatypes, which are now considered equal if they define
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   561
 *       identical datatypes.
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   562
 *       This means that in the following example
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   563
 *         TYPE 
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   564
 *          array_t: ARRAY [1..3] OF INT; 
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   565
 *         END_TYPE;
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   566
 *         VAR
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   567
 *          array_var1: array_t; 
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   568
 *          array_var2: ARRAY [1..3] OF INT; 
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   569
 *          array_var3: ARRAY [1..3] OF INT; 
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   570
 *         END_VAR
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   571
 * 
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   572
 *       all three variables (array_var1, array_var2, and array_var3) are considered as being of the
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   573
 *       same datatype.
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   574
 *      
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   575
 *       Note that the strict datatype model currently actually uses a relaxed datatype model for 
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   576
 *       REF_TO datatypes, so in both the relaxed and strict datatype models matiec currently uses a 
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   577
 *       relaxed datatype equivalince for REF_TO datatypes.
929
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   578
 */
676
ca4f17211251 Move is_datatype_valid/equal() to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 668
diff changeset
   579
bool get_datatype_info_c::is_type_equal(symbol_c *first_type, symbol_c *second_type) {
921
d228aaa4d616 Introduce absyntax class for keyword ANY, and use REF_TO(ANY) as datatype of NULL literal.
mjsousa
parents: 919
diff changeset
   580
  if (!is_type_valid( first_type))                                   {return false;}
d228aaa4d616 Introduce absyntax class for keyword ANY, and use REF_TO(ANY) as datatype of NULL literal.
mjsousa
parents: 919
diff changeset
   581
  if (!is_type_valid(second_type))                                   {return false;}
d228aaa4d616 Introduce absyntax class for keyword ANY, and use REF_TO(ANY) as datatype of NULL literal.
mjsousa
parents: 919
diff changeset
   582
d228aaa4d616 Introduce absyntax class for keyword ANY, and use REF_TO(ANY) as datatype of NULL literal.
mjsousa
parents: 919
diff changeset
   583
  /* GENERIC DATATYPES */
d228aaa4d616 Introduce absyntax class for keyword ANY, and use REF_TO(ANY) as datatype of NULL literal.
mjsousa
parents: 919
diff changeset
   584
  /* For the moment, we only support the ANY generic datatype! */
d228aaa4d616 Introduce absyntax class for keyword ANY, and use REF_TO(ANY) as datatype of NULL literal.
mjsousa
parents: 919
diff changeset
   585
  if ((is_ANY_generic_type( first_type)) ||
d228aaa4d616 Introduce absyntax class for keyword ANY, and use REF_TO(ANY) as datatype of NULL literal.
mjsousa
parents: 919
diff changeset
   586
      (is_ANY_generic_type(second_type)))                            {return true;}
d228aaa4d616 Introduce absyntax class for keyword ANY, and use REF_TO(ANY) as datatype of NULL literal.
mjsousa
parents: 919
diff changeset
   587
      
909
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   588
  /* ANY_ELEMENTARY */
945
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   589
  if ((is_ANY_ELEMENTARY_compatible(first_type)) &&
695
5760f1043ba4 Code formating only.
Mario de Sousa <msousa@fe.up.pt>
parents: 693
diff changeset
   590
      (typeid(*first_type) == typeid(*second_type)))                 {return true;}
945
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   591
  if (   is_ANY_ELEMENTARY_compatible(first_type) 
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   592
      || is_ANY_ELEMENTARY_compatible(second_type))                  {return false;}  
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   593
  
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   594
  /* ANY_DERIVED  */
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   595
  // from now on, we are sure both datatypes are derived...
919
8da635655f37 Add support for the 'NULL' keyword, defined in version 3 of IEC 61131-3.
mjsousa
parents: 909
diff changeset
   596
  if (is_ref_to(first_type) && is_ref_to(second_type)) {
8da635655f37 Add support for the 'NULL' keyword, defined in version 3 of IEC 61131-3.
mjsousa
parents: 909
diff changeset
   597
    return is_type_equal(search_base_type_c::get_basetype_decl(get_ref_to(first_type )),
8da635655f37 Add support for the 'NULL' keyword, defined in version 3 of IEC 61131-3.
mjsousa
parents: 909
diff changeset
   598
                         search_base_type_c::get_basetype_decl(get_ref_to(second_type)));
8da635655f37 Add support for the 'NULL' keyword, defined in version 3 of IEC 61131-3.
mjsousa
parents: 909
diff changeset
   599
  }
945
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   600
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   601
    // check for same datatype
946
c012a64dc2fa Make the relaxed datatype model a runtime option (off by default)
mjsousa
parents: 945
diff changeset
   602
  if (first_type == second_type)                                     {return true;}
945
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   603
  
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   604
    // remaining type equivalence rules are not applied in the strict datatype model
946
c012a64dc2fa Make the relaxed datatype model a runtime option (off by default)
mjsousa
parents: 945
diff changeset
   605
  if (false == runtime_options.relaxed_datatype_model)               {return false;}
945
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   606
  
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   607
    // check for array equivalence usig the relaxed datatype model
946
c012a64dc2fa Make the relaxed datatype model a runtime option (off by default)
mjsousa
parents: 945
diff changeset
   608
  if (is_arraytype_equal_relaxed(first_type, second_type))           {return true;}
945
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   609
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   610
  return false;
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   611
}
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   612
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   613
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   614
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   615
/* A local helper function that transforms strings conatining signed_integers into a normalized
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   616
 * form, so they can be compared for equality.
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   617
 *   examples:
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   618
 *     82  ->  82 
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   619
 *     8_2 ->  82 
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   620
 *    +82  ->  82
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   621
 *    082  ->  82
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   622
 *   +082  ->  82
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   623
 *    -82  -> -82
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   624
 *    -8_2 -> -82
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   625
 *   -082  -> -82
987
562b67922966 Let get_datatype_info_c handle variable sized arrays, even if constant folding is not yet done.
mjsousa
parents: 986
diff changeset
   626
 * 
562b67922966 Let get_datatype_info_c handle variable sized arrays, even if constant folding is not yet done.
mjsousa
parents: 986
diff changeset
   627
 * NOTE: since matiec supports arrays with a variable size (a non compliant IEC 61131-3 extension)
562b67922966 Let get_datatype_info_c handle variable sized arrays, even if constant folding is not yet done.
mjsousa
parents: 986
diff changeset
   628
 *        (e.g.: ARRAY [1..max] of INT, where max must be a constant variable)
562b67922966 Let get_datatype_info_c handle variable sized arrays, even if constant folding is not yet done.
mjsousa
parents: 986
diff changeset
   629
 *       the symbol passed to this function may also be a symbolic_variable
562b67922966 Let get_datatype_info_c handle variable sized arrays, even if constant folding is not yet done.
mjsousa
parents: 986
diff changeset
   630
 *       (or more correctly, a symbolic_constant_c).
562b67922966 Let get_datatype_info_c handle variable sized arrays, even if constant folding is not yet done.
mjsousa
parents: 986
diff changeset
   631
 *       In this case we simply return the string itself.
945
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   632
 */
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   633
#include <string.h>  /* required for strlen() */
987
562b67922966 Let get_datatype_info_c handle variable sized arrays, even if constant folding is not yet done.
mjsousa
parents: 986
diff changeset
   634
static std::string normalize_subrange_limit(symbol_c *symbol) {
562b67922966 Let get_datatype_info_c handle variable sized arrays, even if constant folding is not yet done.
mjsousa
parents: 986
diff changeset
   635
  // See if it is an integer...  
562b67922966 Let get_datatype_info_c handle variable sized arrays, even if constant folding is not yet done.
mjsousa
parents: 986
diff changeset
   636
  integer_c *integer = dynamic_cast<integer_c *>(symbol);
562b67922966 Let get_datatype_info_c handle variable sized arrays, even if constant folding is not yet done.
mjsousa
parents: 986
diff changeset
   637
  if (NULL != integer) {
562b67922966 Let get_datatype_info_c handle variable sized arrays, even if constant folding is not yet done.
mjsousa
parents: 986
diff changeset
   638
    // handle it as an integer!
562b67922966 Let get_datatype_info_c handle variable sized arrays, even if constant folding is not yet done.
mjsousa
parents: 986
diff changeset
   639
    std::string str = "";
562b67922966 Let get_datatype_info_c handle variable sized arrays, even if constant folding is not yet done.
mjsousa
parents: 986
diff changeset
   640
    bool leading_zero = true;
562b67922966 Let get_datatype_info_c handle variable sized arrays, even if constant folding is not yet done.
mjsousa
parents: 986
diff changeset
   641
    unsigned int offset = 0;
562b67922966 Let get_datatype_info_c handle variable sized arrays, even if constant folding is not yet done.
mjsousa
parents: 986
diff changeset
   642
562b67922966 Let get_datatype_info_c handle variable sized arrays, even if constant folding is not yet done.
mjsousa
parents: 986
diff changeset
   643
    // handle any possible leading '-' or '+'
562b67922966 Let get_datatype_info_c handle variable sized arrays, even if constant folding is not yet done.
mjsousa
parents: 986
diff changeset
   644
    if        (integer->value[0] == '-') {
562b67922966 Let get_datatype_info_c handle variable sized arrays, even if constant folding is not yet done.
mjsousa
parents: 986
diff changeset
   645
        //    '-' -> retained
562b67922966 Let get_datatype_info_c handle variable sized arrays, even if constant folding is not yet done.
mjsousa
parents: 986
diff changeset
   646
        str += integer->value[0];
562b67922966 Let get_datatype_info_c handle variable sized arrays, even if constant folding is not yet done.
mjsousa
parents: 986
diff changeset
   647
        offset++;
562b67922966 Let get_datatype_info_c handle variable sized arrays, even if constant folding is not yet done.
mjsousa
parents: 986
diff changeset
   648
    } else if (integer->value[0] == '+')
562b67922966 Let get_datatype_info_c handle variable sized arrays, even if constant folding is not yet done.
mjsousa
parents: 986
diff changeset
   649
        //    '+' -> skip, so '+8' and '8' will both result in '8'
562b67922966 Let get_datatype_info_c handle variable sized arrays, even if constant folding is not yet done.
mjsousa
parents: 986
diff changeset
   650
        offset++;
562b67922966 Let get_datatype_info_c handle variable sized arrays, even if constant folding is not yet done.
mjsousa
parents: 986
diff changeset
   651
      
562b67922966 Let get_datatype_info_c handle variable sized arrays, even if constant folding is not yet done.
mjsousa
parents: 986
diff changeset
   652
    for (unsigned int i = offset; i < strlen(integer->value); i++) {
562b67922966 Let get_datatype_info_c handle variable sized arrays, even if constant folding is not yet done.
mjsousa
parents: 986
diff changeset
   653
      if (leading_zero && (integer->value[i] != '0'))
562b67922966 Let get_datatype_info_c handle variable sized arrays, even if constant folding is not yet done.
mjsousa
parents: 986
diff changeset
   654
        leading_zero = false;
562b67922966 Let get_datatype_info_c handle variable sized arrays, even if constant folding is not yet done.
mjsousa
parents: 986
diff changeset
   655
      if (!leading_zero && integer->value[i] != '_')
562b67922966 Let get_datatype_info_c handle variable sized arrays, even if constant folding is not yet done.
mjsousa
parents: 986
diff changeset
   656
        str += integer->value[i];
562b67922966 Let get_datatype_info_c handle variable sized arrays, even if constant folding is not yet done.
mjsousa
parents: 986
diff changeset
   657
    }
562b67922966 Let get_datatype_info_c handle variable sized arrays, even if constant folding is not yet done.
mjsousa
parents: 986
diff changeset
   658
    return str;
945
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   659
  }
987
562b67922966 Let get_datatype_info_c handle variable sized arrays, even if constant folding is not yet done.
mjsousa
parents: 986
diff changeset
   660
  
562b67922966 Let get_datatype_info_c handle variable sized arrays, even if constant folding is not yet done.
mjsousa
parents: 986
diff changeset
   661
  // See if it is an sybolic_variable_c or symbolic_constant_c...  
562b67922966 Let get_datatype_info_c handle variable sized arrays, even if constant folding is not yet done.
mjsousa
parents: 986
diff changeset
   662
  /* NOTE: Remember that this is only needed if the subrange limit has not yet been
562b67922966 Let get_datatype_info_c handle variable sized arrays, even if constant folding is not yet done.
mjsousa
parents: 986
diff changeset
   663
   *       constant_folded --> when the const_value is valid, the normalize_subrange_limit()
562b67922966 Let get_datatype_info_c handle variable sized arrays, even if constant folding is not yet done.
mjsousa
parents: 986
diff changeset
   664
   *       never gets called!!
562b67922966 Let get_datatype_info_c handle variable sized arrays, even if constant folding is not yet done.
mjsousa
parents: 986
diff changeset
   665
   * 
562b67922966 Let get_datatype_info_c handle variable sized arrays, even if constant folding is not yet done.
mjsousa
parents: 986
diff changeset
   666
   *       Situations where it has not been constant folded can occur if:
562b67922966 Let get_datatype_info_c handle variable sized arrays, even if constant folding is not yet done.
mjsousa
parents: 986
diff changeset
   667
   *         - the get_datatype_info_c::is_type_equal() is called before the constant folding algorithm does its thing
562b67922966 Let get_datatype_info_c handle variable sized arrays, even if constant folding is not yet done.
mjsousa
parents: 986
diff changeset
   668
   *         - the constant folding algorithm is called before get_datatype_info_c::is_type_equal(), but
562b67922966 Let get_datatype_info_c handle variable sized arrays, even if constant folding is not yet done.
mjsousa
parents: 986
diff changeset
   669
   *           the symbol does not get constant folded
562b67922966 Let get_datatype_info_c handle variable sized arrays, even if constant folding is not yet done.
mjsousa
parents: 986
diff changeset
   670
   *           (e.g: the POU containing a VAR_EXTERN is not instantiated, and that external variable is used to define a 
562b67922966 Let get_datatype_info_c handle variable sized arrays, even if constant folding is not yet done.
mjsousa
parents: 986
diff changeset
   671
   *            limit of an array (ARRAY of [1..ext_var] OF INT)
562b67922966 Let get_datatype_info_c handle variable sized arrays, even if constant folding is not yet done.
mjsousa
parents: 986
diff changeset
   672
   *        However, currently get_datatype_info_c::is_type_equal() is not called to handle the above case, 
562b67922966 Let get_datatype_info_c handle variable sized arrays, even if constant folding is not yet done.
mjsousa
parents: 986
diff changeset
   673
   *        and constant_folding is being called before all algorithms that call get_datatype_info_c::is_type_equal(),
562b67922966 Let get_datatype_info_c handle variable sized arrays, even if constant folding is not yet done.
mjsousa
parents: 986
diff changeset
   674
   *        which means that the following code is really not needed. But it is best to have it here just in case...
562b67922966 Let get_datatype_info_c handle variable sized arrays, even if constant folding is not yet done.
mjsousa
parents: 986
diff changeset
   675
   */
562b67922966 Let get_datatype_info_c handle variable sized arrays, even if constant folding is not yet done.
mjsousa
parents: 986
diff changeset
   676
  token_c             *token    = NULL;
562b67922966 Let get_datatype_info_c handle variable sized arrays, even if constant folding is not yet done.
mjsousa
parents: 986
diff changeset
   677
  symbolic_constant_c *symconst = dynamic_cast<symbolic_constant_c *>(symbol);
562b67922966 Let get_datatype_info_c handle variable sized arrays, even if constant folding is not yet done.
mjsousa
parents: 986
diff changeset
   678
  symbolic_variable_c *symvar   = dynamic_cast<symbolic_variable_c *>(symbol);
562b67922966 Let get_datatype_info_c handle variable sized arrays, even if constant folding is not yet done.
mjsousa
parents: 986
diff changeset
   679
  if (NULL != symconst) token   = dynamic_cast<            token_c *>(symconst->var_name);
562b67922966 Let get_datatype_info_c handle variable sized arrays, even if constant folding is not yet done.
mjsousa
parents: 986
diff changeset
   680
  if (NULL != symvar  ) token   = dynamic_cast<            token_c *>(symvar  ->var_name);
562b67922966 Let get_datatype_info_c handle variable sized arrays, even if constant folding is not yet done.
mjsousa
parents: 986
diff changeset
   681
  if (NULL != token)
562b67922966 Let get_datatype_info_c handle variable sized arrays, even if constant folding is not yet done.
mjsousa
parents: 986
diff changeset
   682
    // handle it as a symbolic_variable/constant_c
562b67922966 Let get_datatype_info_c handle variable sized arrays, even if constant folding is not yet done.
mjsousa
parents: 986
diff changeset
   683
    return token->value;    
562b67922966 Let get_datatype_info_c handle variable sized arrays, even if constant folding is not yet done.
mjsousa
parents: 986
diff changeset
   684
  
562b67922966 Let get_datatype_info_c handle variable sized arrays, even if constant folding is not yet done.
mjsousa
parents: 986
diff changeset
   685
  ERROR;
562b67922966 Let get_datatype_info_c handle variable sized arrays, even if constant folding is not yet done.
mjsousa
parents: 986
diff changeset
   686
  return NULL; // humour the compiler...
945
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   687
}
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   688
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   689
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   690
/* A helper method to get_datatype_info_c::is_type_equal()
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   691
 *  Assuming the relaxed datatype model, determine whether the two array datatypes are equal/equivalent
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   692
 */
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   693
bool get_datatype_info_c::is_arraytype_equal_relaxed(symbol_c *first_type, symbol_c *second_type) {
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   694
  symbol_c *basetype_1 = search_base_type_c::get_basetype_decl( first_type);
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   695
  symbol_c *basetype_2 = search_base_type_c::get_basetype_decl(second_type);
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   696
  array_specification_c *array_1 = dynamic_cast<array_specification_c *>(basetype_1);
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   697
  array_specification_c *array_2 = dynamic_cast<array_specification_c *>(basetype_2);
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   698
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   699
  // are they both array datatypes? 
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   700
  if ((NULL == array_1) || (NULL == array_2))
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   701
    return false;
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   702
  
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   703
  // number of subranges
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   704
  array_subrange_list_c *subrange_list_1 = dynamic_cast<array_subrange_list_c *>(array_1->array_subrange_list);
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   705
  array_subrange_list_c *subrange_list_2 = dynamic_cast<array_subrange_list_c *>(array_2->array_subrange_list);
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   706
  if ((NULL == subrange_list_1) || (NULL == subrange_list_2)) ERROR;
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   707
  if (subrange_list_1->n != subrange_list_2->n)
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   708
    return false;
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   709
  
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   710
  // comparison of each subrange start and end elements
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   711
  for (int i = 0; i < subrange_list_1->n; i++) {
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   712
    subrange_c *subrange_1 = dynamic_cast<subrange_c *>(subrange_list_1->elements[i]);
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   713
    subrange_c *subrange_2 = dynamic_cast<subrange_c *>(subrange_list_2->elements[i]);
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   714
    if ((NULL == subrange_1) || (NULL == subrange_2)) ERROR;
986
2064a22cc1f2 Correctly analyse external<->global var compatibility when using variable sized arrays (TODO: does not yet work for FBs!)
mjsousa
parents: 958
diff changeset
   715
    
2064a22cc1f2 Correctly analyse external<->global var compatibility when using variable sized arrays (TODO: does not yet work for FBs!)
mjsousa
parents: 958
diff changeset
   716
    /* check whether the subranges have the same values, using the result of the constant folding agorithm.
945
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   717
     * This method has the drawback that it inserts a dependency on having to run the constant folding algorithm before
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   718
     *  the get_datatype_info_c::is_type_equal() method is called.
986
2064a22cc1f2 Correctly analyse external<->global var compatibility when using variable sized arrays (TODO: does not yet work for FBs!)
mjsousa
parents: 958
diff changeset
   719
     *  This is why we implement an alternative method in case the subrange limits have not yet been reduced to a cvalue!
945
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   720
     */
986
2064a22cc1f2 Correctly analyse external<->global var compatibility when using variable sized arrays (TODO: does not yet work for FBs!)
mjsousa
parents: 958
diff changeset
   721
    if (    (subrange_1->lower_limit->const_value._int64.is_valid() || subrange_1->lower_limit->const_value._uint64.is_valid())
2064a22cc1f2 Correctly analyse external<->global var compatibility when using variable sized arrays (TODO: does not yet work for FBs!)
mjsousa
parents: 958
diff changeset
   722
         && (subrange_2->lower_limit->const_value._int64.is_valid() || subrange_2->lower_limit->const_value._uint64.is_valid())
2064a22cc1f2 Correctly analyse external<->global var compatibility when using variable sized arrays (TODO: does not yet work for FBs!)
mjsousa
parents: 958
diff changeset
   723
         && (subrange_1->upper_limit->const_value._int64.is_valid() || subrange_1->upper_limit->const_value._uint64.is_valid())
2064a22cc1f2 Correctly analyse external<->global var compatibility when using variable sized arrays (TODO: does not yet work for FBs!)
mjsousa
parents: 958
diff changeset
   724
         && (subrange_2->upper_limit->const_value._int64.is_valid() || subrange_2->upper_limit->const_value._uint64.is_valid())
2064a22cc1f2 Correctly analyse external<->global var compatibility when using variable sized arrays (TODO: does not yet work for FBs!)
mjsousa
parents: 958
diff changeset
   725
       ) {
2064a22cc1f2 Correctly analyse external<->global var compatibility when using variable sized arrays (TODO: does not yet work for FBs!)
mjsousa
parents: 958
diff changeset
   726
      if (! (subrange_1->lower_limit->const_value == subrange_2->lower_limit->const_value)) return false;
2064a22cc1f2 Correctly analyse external<->global var compatibility when using variable sized arrays (TODO: does not yet work for FBs!)
mjsousa
parents: 958
diff changeset
   727
      if (! (subrange_1->upper_limit->const_value == subrange_2->upper_limit->const_value)) return false;
2064a22cc1f2 Correctly analyse external<->global var compatibility when using variable sized arrays (TODO: does not yet work for FBs!)
mjsousa
parents: 958
diff changeset
   728
    } else {
987
562b67922966 Let get_datatype_info_c handle variable sized arrays, even if constant folding is not yet done.
mjsousa
parents: 986
diff changeset
   729
      // NOTE: nocasecmp_c() class is defined in absyntax.hh. nocasecmp_c() instantiates an object, and nocasecmp_c()() uses the () operator on that object. 
562b67922966 Let get_datatype_info_c handle variable sized arrays, even if constant folding is not yet done.
mjsousa
parents: 986
diff changeset
   730
      if (! nocasecmp_c()(normalize_subrange_limit(subrange_1->lower_limit), normalize_subrange_limit(subrange_2->lower_limit))) return false;
562b67922966 Let get_datatype_info_c handle variable sized arrays, even if constant folding is not yet done.
mjsousa
parents: 986
diff changeset
   731
      if (! nocasecmp_c()(normalize_subrange_limit(subrange_1->upper_limit), normalize_subrange_limit(subrange_2->upper_limit))) return false;
986
2064a22cc1f2 Correctly analyse external<->global var compatibility when using variable sized arrays (TODO: does not yet work for FBs!)
mjsousa
parents: 958
diff changeset
   732
    }
945
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   733
  }
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   734
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   735
  return is_type_equal(search_base_type_c::get_basetype_decl(array_1->non_generic_type_name),
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   736
                       search_base_type_c::get_basetype_decl(array_2->non_generic_type_name));
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   737
}
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   738
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   739
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   740
676
ca4f17211251 Move is_datatype_valid/equal() to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 668
diff changeset
   741
ca4f17211251 Move is_datatype_valid/equal() to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 668
diff changeset
   742
ca4f17211251 Move is_datatype_valid/equal() to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 668
diff changeset
   743
bool get_datatype_info_c::is_type_valid(symbol_c *type) {
695
5760f1043ba4 Code formating only.
Mario de Sousa <msousa@fe.up.pt>
parents: 693
diff changeset
   744
  if (NULL == type)                                                  {return false;}
5760f1043ba4 Code formating only.
Mario de Sousa <msousa@fe.up.pt>
parents: 693
diff changeset
   745
  if (typeid(*type) == typeid(invalid_type_name_c))                  {return false;}
676
ca4f17211251 Move is_datatype_valid/equal() to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 668
diff changeset
   746
  return true;
ca4f17211251 Move is_datatype_valid/equal() to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 668
diff changeset
   747
}
ca4f17211251 Move is_datatype_valid/equal() to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 668
diff changeset
   748
ca4f17211251 Move is_datatype_valid/equal() to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 668
diff changeset
   749
ca4f17211251 Move is_datatype_valid/equal() to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 668
diff changeset
   750
ca4f17211251 Move is_datatype_valid/equal() to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 668
diff changeset
   751
ca4f17211251 Move is_datatype_valid/equal() to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 668
diff changeset
   752
ca4f17211251 Move is_datatype_valid/equal() to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 668
diff changeset
   753
909
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   754
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   755
/* returns the datatype the REF_TO datatype references/points to... */ 
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   756
symbol_c *get_datatype_info_c::get_ref_to(symbol_c *type_symbol) {
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   757
  ref_type_decl_c *type1 = dynamic_cast<ref_type_decl_c *>(type_symbol);
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   758
  if (NULL != type1) type_symbol = type1->ref_spec_init;
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   759
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   760
  ref_spec_init_c *type2 = dynamic_cast<ref_spec_init_c *>(type_symbol);
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   761
  if (NULL != type2) type_symbol = type2->ref_spec;
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   762
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   763
  ref_spec_c      *type3 = dynamic_cast<ref_spec_c      *>(type_symbol);
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   764
  if (NULL != type3) return type3->type_name;
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   765
  
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   766
  return NULL; /* this is not a ref datatype!! */
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   767
}
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   768
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   769
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   770
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   771
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   772
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   773
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   774
bool get_datatype_info_c::is_ref_to(symbol_c *type_symbol) {
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   775
  symbol_c *type_decl = search_base_type_c::get_basetype_decl(type_symbol);
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   776
  if (NULL == type_decl)                                                       {return false;}
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   777
  
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   778
  if (typeid(*type_decl) == typeid(ref_type_decl_c))                           {return true;}   /* identifier ':' ref_spec_init */
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   779
  if (typeid(*type_decl) == typeid(ref_spec_init_c))                           {return true;}   /* ref_spec [ ASSIGN ref_initialization ]; */
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   780
  if (typeid(*type_decl) == typeid(ref_spec_c))                                {return true;}   /* REF_TO (non_generic_type_name | function_block_type_name) */
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   781
  return false;
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   782
}
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   783
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   784
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   785
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   786
666
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   787
bool get_datatype_info_c::is_sfc_initstep(symbol_c *type_symbol) {
718
a9f8cc778444 Make search_base_type_c a singleton!
Mario de Sousa <msousa@fe.up.pt>
parents: 699
diff changeset
   788
  symbol_c *type_decl = search_base_type_c::get_basetype_decl(type_symbol); 
832
8cd104e483c6 Allow get_datatype_info_c to be called with NULL parameters.
mjsousa
parents: 778
diff changeset
   789
  if (NULL == type_decl)                                             {return false;}
666
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   790
  if (typeid(*type_decl) == typeid(initial_step_c))                  {return true;}   /* INITIAL_STEP step_name ':' action_association_list END_STEP */  /* A pseudo data type! */
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   791
  return false;
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   792
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   793
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   794
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   795
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   796
bool get_datatype_info_c::is_sfc_step(symbol_c *type_symbol) {
718
a9f8cc778444 Make search_base_type_c a singleton!
Mario de Sousa <msousa@fe.up.pt>
parents: 699
diff changeset
   797
  symbol_c *type_decl = search_base_type_c::get_basetype_decl(type_symbol); 
832
8cd104e483c6 Allow get_datatype_info_c to be called with NULL parameters.
mjsousa
parents: 778
diff changeset
   798
  if (NULL == type_decl)                                             {return false;}
666
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   799
  if (typeid(*type_decl) == typeid(initial_step_c))                  {return true;}   /* INITIAL_STEP step_name ':' action_association_list END_STEP */  /* A pseudo data type! */
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   800
  if (typeid(*type_decl) == typeid(        step_c))                  {return true;}   /*         STEP step_name ':' action_association_list END_STEP */  /* A pseudo data type! */
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   801
  return false;
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   802
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   803
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   804
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   805
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   806
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   807
bool get_datatype_info_c::is_function_block(symbol_c *type_symbol) {
718
a9f8cc778444 Make search_base_type_c a singleton!
Mario de Sousa <msousa@fe.up.pt>
parents: 699
diff changeset
   808
  symbol_c *type_decl = search_base_type_c::get_basetype_decl(type_symbol); 
832
8cd104e483c6 Allow get_datatype_info_c to be called with NULL parameters.
mjsousa
parents: 778
diff changeset
   809
  if (NULL == type_decl)                                             {return false;}
666
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   810
  if (typeid(*type_decl) == typeid(function_block_declaration_c))    {return true;}   /*  FUNCTION_BLOCK derived_function_block_name io_OR_other_var_declarations function_block_body END_FUNCTION_BLOCK */
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   811
  return false;
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   812
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   813
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   814
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   815
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   816
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   817
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   818
bool get_datatype_info_c::is_subrange(symbol_c *type_symbol) {
858
c5f145364a4f Fix get_datatype_info_c::is_subrange(), which did not work when using base type! (we now use get_equivtype() instead of get_base_type() )
mjsousa
parents: 832
diff changeset
   819
  symbol_c *type_decl = search_base_type_c::get_equivtype_decl(type_symbol); /* NOTE: do NOT call search_base_type_c !! */
832
8cd104e483c6 Allow get_datatype_info_c to be called with NULL parameters.
mjsousa
parents: 778
diff changeset
   820
  if (NULL == type_decl)                                             {return false;}
666
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   821
  
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   822
  if (typeid(*type_decl) == typeid(subrange_type_declaration_c))     {return true;}   /*  subrange_type_name ':' subrange_spec_init */
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   823
  if (typeid(*type_decl) == typeid(subrange_spec_init_c))            {return true;}   /* subrange_specification ASSIGN signed_integer */
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   824
  if (typeid(*type_decl) == typeid(subrange_specification_c))        {return true;}   /*  integer_type_name '(' subrange')' */
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   825
    
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   826
  if (typeid(*type_decl) == typeid(subrange_c))                      {ERROR;}         /*  signed_integer DOTDOT signed_integer */
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   827
  return false;
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   828
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   829
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   830
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   831
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   832
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   833
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   834
bool get_datatype_info_c::is_enumerated(symbol_c *type_symbol) {
718
a9f8cc778444 Make search_base_type_c a singleton!
Mario de Sousa <msousa@fe.up.pt>
parents: 699
diff changeset
   835
  symbol_c *type_decl = search_base_type_c::get_basetype_decl(type_symbol);
832
8cd104e483c6 Allow get_datatype_info_c to be called with NULL parameters.
mjsousa
parents: 778
diff changeset
   836
  if (NULL == type_decl)                                             {return false;}
666
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   837
  
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   838
  if (typeid(*type_decl) == typeid(enumerated_type_declaration_c))   {return true;}   /*  enumerated_type_name ':' enumerated_spec_init */
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   839
  if (typeid(*type_decl) == typeid(enumerated_spec_init_c))          {return true;}   /* enumerated_specification ASSIGN enumerated_value */
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   840
  if (typeid(*type_decl) == typeid(enumerated_value_list_c))         {return true;}   /* enumerated_value_list ',' enumerated_value */        /* once we change the way we handle enums, this will probably become an ERROR! */
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   841
  
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   842
  if (typeid(*type_decl) == typeid(enumerated_value_c))              {ERROR;}         /* enumerated_type_name '#' identifier */
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   843
  return false;
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   844
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   845
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   846
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   847
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   848
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   849
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   850
bool get_datatype_info_c::is_array(symbol_c *type_symbol) {
718
a9f8cc778444 Make search_base_type_c a singleton!
Mario de Sousa <msousa@fe.up.pt>
parents: 699
diff changeset
   851
  symbol_c *type_decl = search_base_type_c::get_basetype_decl(type_symbol);
832
8cd104e483c6 Allow get_datatype_info_c to be called with NULL parameters.
mjsousa
parents: 778
diff changeset
   852
  if (NULL == type_decl)                                             {return false;}
666
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   853
  
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   854
  if (typeid(*type_decl) == typeid(array_type_declaration_c))        {return true;}   /*  identifier ':' array_spec_init */
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   855
  if (typeid(*type_decl) == typeid(array_spec_init_c))               {return true;}   /* array_specification [ASSIGN array_initialization} */
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   856
  if (typeid(*type_decl) == typeid(array_specification_c))           {return true;}   /* ARRAY '[' array_subrange_list ']' OF non_generic_type_name */
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   857
  
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   858
  if (typeid(*type_decl) == typeid(array_subrange_list_c))           {ERROR;}         /* array_subrange_list ',' subrange */
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   859
  if (typeid(*type_decl) == typeid(array_initial_elements_list_c))   {ERROR;}         /* array_initialization:  '[' array_initial_elements_list ']' */  /* array_initial_elements_list ',' array_initial_elements */
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   860
  if (typeid(*type_decl) == typeid(array_initial_elements_c))        {ERROR;}         /* integer '(' [array_initial_element] ')' */
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   861
  return false;
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   862
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   863
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   864
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   865
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   866
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   867
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   868
bool get_datatype_info_c::is_structure(symbol_c *type_symbol) {
718
a9f8cc778444 Make search_base_type_c a singleton!
Mario de Sousa <msousa@fe.up.pt>
parents: 699
diff changeset
   869
  symbol_c *type_decl = search_base_type_c::get_basetype_decl(type_symbol);
832
8cd104e483c6 Allow get_datatype_info_c to be called with NULL parameters.
mjsousa
parents: 778
diff changeset
   870
  if (NULL == type_decl)                                                       {return false;}
666
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   871
  
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   872
  if (typeid(*type_decl) == typeid(structure_type_declaration_c))              {return true;}   /*  structure_type_name ':' structure_specification */
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   873
  if (typeid(*type_decl) == typeid(initialized_structure_c))                   {return true;}   /* structure_type_name ASSIGN structure_initialization */
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   874
  if (typeid(*type_decl) == typeid(structure_element_declaration_list_c))      {return true;}   /* structure_declaration:  STRUCT structure_element_declaration_list END_STRUCT */ /* structure_element_declaration_list structure_element_declaration ';' */
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   875
  
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   876
  if (typeid(*type_decl) == typeid(structure_element_declaration_c))           {ERROR;}         /*  structure_element_name ':' *_spec_init */
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   877
  if (typeid(*type_decl) == typeid(structure_element_initialization_list_c))   {ERROR;}         /* structure_initialization: '(' structure_element_initialization_list ')' */  /* structure_element_initialization_list ',' structure_element_initialization */
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   878
  if (typeid(*type_decl) == typeid(structure_element_initialization_c))        {ERROR;}         /*  structure_element_name ASSIGN value */
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   879
  return false;
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   880
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   881
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   882
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   883
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   884
921
d228aaa4d616 Introduce absyntax class for keyword ANY, and use REF_TO(ANY) as datatype of NULL literal.
mjsousa
parents: 919
diff changeset
   885
bool get_datatype_info_c::is_ANY_generic_type(symbol_c *type_symbol) {
d228aaa4d616 Introduce absyntax class for keyword ANY, and use REF_TO(ANY) as datatype of NULL literal.
mjsousa
parents: 919
diff changeset
   886
  symbol_c *type_decl = search_base_type_c::get_basetype_decl(type_symbol);
d228aaa4d616 Introduce absyntax class for keyword ANY, and use REF_TO(ANY) as datatype of NULL literal.
mjsousa
parents: 919
diff changeset
   887
  if (NULL == type_decl)                                             {return false;}  
d228aaa4d616 Introduce absyntax class for keyword ANY, and use REF_TO(ANY) as datatype of NULL literal.
mjsousa
parents: 919
diff changeset
   888
  if (typeid(*type_decl) == typeid(generic_type_any_c))              {return true;}   /*  The ANY keyword! */
d228aaa4d616 Introduce absyntax class for keyword ANY, and use REF_TO(ANY) as datatype of NULL literal.
mjsousa
parents: 919
diff changeset
   889
  return false;
d228aaa4d616 Introduce absyntax class for keyword ANY, and use REF_TO(ANY) as datatype of NULL literal.
mjsousa
parents: 919
diff changeset
   890
}
666
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   891
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   892
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   893
bool get_datatype_info_c::is_ANY_ELEMENTARY(symbol_c *type_symbol) {
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   894
  if (type_symbol == NULL)                                     {return false;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   895
  if (is_ANY_MAGNITUDE(type_symbol))                           {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   896
  if (is_ANY_BIT      (type_symbol))                           {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   897
  if (is_ANY_STRING   (type_symbol))                           {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   898
  if (is_ANY_DATE     (type_symbol))                           {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   899
  return false;
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   900
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   901
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   902
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   903
bool get_datatype_info_c::is_ANY_SAFEELEMENTARY(symbol_c *type_symbol) {
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   904
  if (type_symbol == NULL)                                     {return false;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   905
  if (is_ANY_SAFEMAGNITUDE(type_symbol))                       {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   906
  if (is_ANY_SAFEBIT      (type_symbol))                       {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   907
  if (is_ANY_SAFESTRING   (type_symbol))                       {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   908
  if (is_ANY_SAFEDATE     (type_symbol))                       {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   909
  return false;
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   910
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   911
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   912
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   913
bool get_datatype_info_c::is_ANY_ELEMENTARY_compatible(symbol_c *type_symbol) {
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   914
  if (type_symbol == NULL)                                     {return false;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   915
  if (is_ANY_ELEMENTARY    (type_symbol))                      {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   916
  if (is_ANY_SAFEELEMENTARY(type_symbol))                      {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   917
  return false;
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   918
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   919
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   920
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   921
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   922
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   923
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   924
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   925
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   926
bool get_datatype_info_c::is_ANY_MAGNITUDE(symbol_c *type_symbol) {
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   927
  if (type_symbol == NULL)                                     {return false;}
668
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
   928
  if (is_TIME(type_symbol))                                    {return true;}
666
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   929
  if (is_ANY_NUM(type_symbol))                                 {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   930
  return false;
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   931
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   932
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   933
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   934
bool get_datatype_info_c::is_ANY_SAFEMAGNITUDE(symbol_c *type_symbol) {
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   935
  if (type_symbol == NULL)                                     {return false;}
668
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
   936
  if (is_SAFETIME(type_symbol))                                {return true;}
666
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   937
  if (is_ANY_SAFENUM(type_symbol))                             {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   938
  return false;
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   939
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   940
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   941
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   942
bool get_datatype_info_c::is_ANY_MAGNITUDE_compatible(symbol_c *type_symbol) {
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   943
  if (type_symbol == NULL)                                     {return false;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   944
  if (is_ANY_MAGNITUDE    (type_symbol))                       {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   945
  if (is_ANY_SAFEMAGNITUDE(type_symbol))                       {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   946
  return false;
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   947
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   948
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   949
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   950
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   951
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   952
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   953
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   954
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   955
bool get_datatype_info_c::is_ANY_signed_MAGNITUDE(symbol_c *type_symbol) {
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   956
  if (type_symbol == NULL)                                     {return false;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   957
  if (typeid(*type_symbol) == typeid(time_type_name_c))        {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   958
  if (is_ANY_signed_NUM(type_symbol))                          {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   959
  return false;
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   960
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   961
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   962
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   963
bool get_datatype_info_c::is_ANY_signed_SAFEMAGNITUDE(symbol_c *type_symbol) {
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   964
  if (type_symbol == NULL)                                     {return false;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   965
  if (typeid(*type_symbol) == typeid(safetime_type_name_c))    {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   966
  return is_ANY_signed_SAFENUM(type_symbol);
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   967
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   968
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   969
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   970
bool get_datatype_info_c::is_ANY_signed_MAGNITUDE_compatible(symbol_c *type_symbol) {
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   971
  if (type_symbol == NULL)                                     {return false;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   972
  if (is_ANY_signed_MAGNITUDE    (type_symbol))                {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   973
  if (is_ANY_signed_SAFEMAGNITUDE(type_symbol))                {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   974
  return false;
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   975
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   976
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   977
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   978
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   979
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   980
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   981
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   982
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   983
bool get_datatype_info_c::is_ANY_NUM(symbol_c *type_symbol) {
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   984
  if (type_symbol == NULL)                                     {return false;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   985
  if (is_ANY_REAL(type_symbol))                                {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   986
  if (is_ANY_INT (type_symbol))                                {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   987
  return false;
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   988
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   989
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   990
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   991
bool get_datatype_info_c::is_ANY_SAFENUM(symbol_c *type_symbol) {
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   992
  if (type_symbol == NULL)                                     {return false;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   993
  if (is_ANY_SAFEREAL(type_symbol))                            {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   994
  if (is_ANY_SAFEINT (type_symbol))                            {return true;}
676
ca4f17211251 Move is_datatype_valid/equal() to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 668
diff changeset
   995
  return false;
666
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   996
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   997
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   998
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   999
bool get_datatype_info_c::is_ANY_NUM_compatible(symbol_c *type_symbol) {
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1000
  if (type_symbol == NULL)                                     {return false;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1001
  if (is_ANY_NUM    (type_symbol))                             {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1002
  if (is_ANY_SAFENUM(type_symbol))                             {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1003
  return false;
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1004
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1005
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1006
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1007
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1008
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1009
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1010
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1011
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1012
bool get_datatype_info_c::is_ANY_signed_NUM(symbol_c *type_symbol) {
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1013
  if (type_symbol == NULL)                                     {return false;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1014
  if (is_ANY_REAL      (type_symbol))                          {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1015
  if (is_ANY_signed_INT(type_symbol))                          {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1016
  return false;
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1017
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1018
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1019
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1020
bool get_datatype_info_c::is_ANY_signed_SAFENUM(symbol_c *type_symbol) {
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1021
  if (type_symbol == NULL)                                     {return false;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1022
  if (is_ANY_SAFEREAL      (type_symbol))                      {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1023
  if (is_ANY_signed_SAFEINT(type_symbol))                      {return true;}
676
ca4f17211251 Move is_datatype_valid/equal() to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 668
diff changeset
  1024
  return false;
666
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1025
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1026
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1027
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1028
bool get_datatype_info_c::is_ANY_signed_NUM_compatible(symbol_c *type_symbol) {
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1029
  if (type_symbol == NULL)                                     {return false;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1030
  if (is_ANY_signed_NUM    (type_symbol))                      {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1031
  if (is_ANY_signed_SAFENUM(type_symbol))                      {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1032
  return false;
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1033
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1034
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1035
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1036
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1037
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1038
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1039
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1040
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1041
bool get_datatype_info_c::is_ANY_INT(symbol_c *type_symbol) {
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1042
  if (type_symbol == NULL)                                     {return false;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1043
  if (is_ANY_signed_INT  (type_symbol))                        {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1044
  if (is_ANY_unsigned_INT(type_symbol))                        {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1045
  return false;
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1046
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1047
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1048
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1049
bool get_datatype_info_c::is_ANY_SAFEINT(symbol_c *type_symbol) {
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1050
  if (type_symbol == NULL)                                     {return false;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1051
  if (is_ANY_signed_SAFEINT  (type_symbol))                    {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1052
  if (is_ANY_unsigned_SAFEINT(type_symbol))                    {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1053
  return false;
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1054
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1055
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1056
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1057
bool get_datatype_info_c::is_ANY_INT_compatible(symbol_c *type_symbol) {
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1058
  if (type_symbol == NULL)                                     {return false;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1059
  if (is_ANY_INT    (type_symbol))                             {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1060
  if (is_ANY_SAFEINT(type_symbol))                             {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1061
  return false;
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1062
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1063
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1064
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1065
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1066
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1067
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1068
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1069
bool get_datatype_info_c::is_ANY_signed_INT(symbol_c *type_symbol) {
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1070
  if (type_symbol == NULL)                                     {return false;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1071
  if (typeid(*type_symbol) == typeid(sint_type_name_c))        {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1072
  if (typeid(*type_symbol) == typeid(int_type_name_c))         {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1073
  if (typeid(*type_symbol) == typeid(dint_type_name_c))        {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1074
  if (typeid(*type_symbol) == typeid(lint_type_name_c))        {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1075
  return false;
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1076
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1077
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1078
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1079
bool get_datatype_info_c::is_ANY_signed_SAFEINT(symbol_c *type_symbol) {
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1080
  if (type_symbol == NULL)                                     {return false;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1081
  if (typeid(*type_symbol) == typeid(safesint_type_name_c))    {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1082
  if (typeid(*type_symbol) == typeid(safeint_type_name_c))     {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1083
  if (typeid(*type_symbol) == typeid(safedint_type_name_c))    {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1084
  if (typeid(*type_symbol) == typeid(safelint_type_name_c))    {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1085
  return false;
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1086
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1087
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1088
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1089
bool get_datatype_info_c::is_ANY_signed_INT_compatible(symbol_c *type_symbol) {
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1090
  if (type_symbol == NULL)                                     {return false;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1091
  if (is_ANY_signed_INT    (type_symbol))                      {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1092
  if (is_ANY_signed_SAFEINT(type_symbol))                      {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1093
  return false;
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1094
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1095
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1096
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1097
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1098
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1099
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1100
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1101
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1102
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1103
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1104
bool get_datatype_info_c::is_ANY_unsigned_INT(symbol_c *type_symbol) {
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1105
  if (type_symbol == NULL)                                     {return false;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1106
  if (typeid(*type_symbol) == typeid(usint_type_name_c))       {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1107
  if (typeid(*type_symbol) == typeid(uint_type_name_c))        {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1108
  if (typeid(*type_symbol) == typeid(udint_type_name_c))       {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1109
  if (typeid(*type_symbol) == typeid(ulint_type_name_c))       {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1110
  return false;
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1111
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1112
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1113
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1114
bool get_datatype_info_c::is_ANY_unsigned_SAFEINT(symbol_c *type_symbol) {
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1115
  if (type_symbol == NULL)                                     {return false;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1116
  if (typeid(*type_symbol) == typeid(safeusint_type_name_c))   {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1117
  if (typeid(*type_symbol) == typeid(safeuint_type_name_c))    {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1118
  if (typeid(*type_symbol) == typeid(safeudint_type_name_c))   {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1119
  if (typeid(*type_symbol) == typeid(safeulint_type_name_c))   {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1120
  return false;
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1121
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1122
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1123
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1124
bool get_datatype_info_c::is_ANY_unsigned_INT_compatible(symbol_c *type_symbol) {
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1125
  if (type_symbol == NULL)                                     {return false;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1126
  if (is_ANY_unsigned_INT    (type_symbol))                    {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1127
  if (is_ANY_unsigned_SAFEINT(type_symbol))                    {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1128
  return false;
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1129
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1130
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1131
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1132
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1133
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1134
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1135
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1136
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1137
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1138
bool get_datatype_info_c::is_ANY_REAL(symbol_c *type_symbol) {
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1139
  if (type_symbol == NULL)                                     {return false;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1140
  if (typeid(*type_symbol) == typeid(real_type_name_c))        {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1141
  if (typeid(*type_symbol) == typeid(lreal_type_name_c))       {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1142
  return false;
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1143
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1144
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1145
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1146
bool get_datatype_info_c::is_ANY_SAFEREAL(symbol_c *type_symbol) {
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1147
  if (type_symbol == NULL)                                     {return false;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1148
  if (typeid(*type_symbol) == typeid(safereal_type_name_c))    {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1149
  if (typeid(*type_symbol) == typeid(safelreal_type_name_c))   {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1150
  return false;
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1151
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1152
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1153
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1154
bool get_datatype_info_c::is_ANY_REAL_compatible(symbol_c *type_symbol) {
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1155
  if (type_symbol == NULL)                                     {return false;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1156
  if (is_ANY_REAL    (type_symbol))                            {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1157
  if (is_ANY_SAFEREAL(type_symbol))                            {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1158
  return false;
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1159
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1160
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1161
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1162
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1163
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1164
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1165
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1166
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1167
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1168
bool get_datatype_info_c::is_ANY_nBIT(symbol_c *type_symbol) {
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1169
  if (type_symbol == NULL)                                     {return false;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1170
  if (typeid(*type_symbol) == typeid(byte_type_name_c))        {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1171
  if (typeid(*type_symbol) == typeid(word_type_name_c))        {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1172
  if (typeid(*type_symbol) == typeid(dword_type_name_c))       {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1173
  if (typeid(*type_symbol) == typeid(lword_type_name_c))       {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1174
  return false;
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1175
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1176
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1177
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1178
bool get_datatype_info_c::is_ANY_SAFEnBIT(symbol_c *type_symbol) {
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1179
  if (type_symbol == NULL)                                     {return false;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1180
  if (typeid(*type_symbol) == typeid(safebyte_type_name_c))    {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1181
  if (typeid(*type_symbol) == typeid(safeword_type_name_c))    {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1182
  if (typeid(*type_symbol) == typeid(safedword_type_name_c))   {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1183
  if (typeid(*type_symbol) == typeid(safelword_type_name_c))   {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1184
  return false;
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1185
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1186
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1187
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1188
bool get_datatype_info_c::is_ANY_nBIT_compatible(symbol_c *type_symbol) {
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1189
  if (type_symbol == NULL)                                     {return false;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1190
  if (is_ANY_nBIT    (type_symbol))                            {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1191
  if (is_ANY_SAFEnBIT(type_symbol))                            {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1192
  return false;
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1193
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1194
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1195
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1196
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1197
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1198
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1199
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1200
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1201
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1202
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1203
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1204
bool get_datatype_info_c::is_BOOL(symbol_c *type_symbol) {
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1205
  if (type_symbol == NULL)                                     {return false;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1206
  if (typeid(*type_symbol) == typeid(bool_type_name_c))        {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1207
  return false;
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1208
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1209
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1210
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1211
bool get_datatype_info_c::is_SAFEBOOL(symbol_c *type_symbol) {
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1212
  if (type_symbol == NULL)                                     {return false;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1213
  if (typeid(*type_symbol) == typeid(safebool_type_name_c))    {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1214
  return false;
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1215
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1216
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1217
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1218
bool get_datatype_info_c::is_BOOL_compatible(symbol_c *type_symbol) {
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1219
  if (type_symbol == NULL)                                     {return false;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1220
  if (is_BOOL    (type_symbol))                                {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1221
  if (is_SAFEBOOL(type_symbol))                                {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1222
  return false;
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1223
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1224
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1225
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1226
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1227
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1228
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1229
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1230
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1231
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1232
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1233
bool get_datatype_info_c::is_ANY_BIT(symbol_c *type_symbol) {
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1234
  if (type_symbol == NULL)                                     {return false;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1235
  if (is_BOOL    (type_symbol))                                {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1236
  if (is_ANY_nBIT(type_symbol))                                {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1237
  return false;
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1238
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1239
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1240
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1241
bool get_datatype_info_c::is_ANY_SAFEBIT(symbol_c *type_symbol) {
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1242
  if (type_symbol == NULL)                                     {return false;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1243
  if (is_SAFEBOOL    (type_symbol))                            {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1244
  if (is_ANY_SAFEnBIT(type_symbol))                            {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1245
  return false;
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1246
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1247
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1248
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1249
bool get_datatype_info_c::is_ANY_BIT_compatible(symbol_c *type_symbol) {
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1250
  if (type_symbol == NULL)                                     {return false;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1251
  if (is_ANY_BIT    (type_symbol))                             {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1252
  if (is_ANY_SAFEBIT(type_symbol))                             {return true;}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1253
  return false;
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1254
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1255
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1256
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1257
668
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1258
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1259
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1260
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1261
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1262
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1263
bool get_datatype_info_c::is_TIME(symbol_c *type_symbol) {
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1264
  if (type_symbol == NULL)                                     {return false;}
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1265
  if (typeid(*type_symbol) == typeid(time_type_name_c))        {return true;}
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1266
  return false;
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1267
}
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1268
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1269
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1270
bool get_datatype_info_c::is_SAFETIME(symbol_c *type_symbol) {
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1271
  if (type_symbol == NULL)                                     {return false;}
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1272
  if (typeid(*type_symbol) == typeid(safetime_type_name_c))    {return true;}
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1273
  return false;
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1274
}
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1275
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1276
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1277
bool get_datatype_info_c::is_TIME_compatible(symbol_c *type_symbol) {
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1278
  if (type_symbol == NULL)                                     {return false;}
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1279
  if (is_TIME    (type_symbol))                                {return true;}
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1280
  if (is_SAFETIME(type_symbol))                                {return true;}
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1281
  return false;
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1282
}
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1283
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1284
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1285
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1286
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1287
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1288
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1289
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1290
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1291
bool get_datatype_info_c::is_ANY_DATE(symbol_c *type_symbol) {
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1292
  if (type_symbol == NULL)                                     {return false;}
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1293
  if (typeid(*type_symbol) == typeid(date_type_name_c))        {return true;}
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1294
  if (typeid(*type_symbol) == typeid(tod_type_name_c))         {return true;}
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1295
  if (typeid(*type_symbol) == typeid(dt_type_name_c))          {return true;}
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1296
  return false;
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1297
}
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1298
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1299
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1300
bool get_datatype_info_c::is_ANY_SAFEDATE(symbol_c *type_symbol) {
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1301
  if (type_symbol == NULL)                                     {return false;}
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1302
  if (typeid(*type_symbol) == typeid(safedate_type_name_c))    {return true;}
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1303
  if (typeid(*type_symbol) == typeid(safetod_type_name_c))     {return true;}
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1304
  if (typeid(*type_symbol) == typeid(safedt_type_name_c))      {return true;}
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1305
  return false;
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1306
}
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1307
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1308
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1309
bool get_datatype_info_c::is_ANY_DATE_compatible(symbol_c *type_symbol) {
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1310
  if (type_symbol == NULL)                                     {return false;}
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1311
  if (is_ANY_DATE    (type_symbol))                            {return true;}
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1312
  if (is_ANY_SAFEDATE(type_symbol))                            {return true;}
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1313
  return false;
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1314
}
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1315
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1316
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1317
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1318
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1319
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1320
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1321
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1322
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1323
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1324
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1325
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1326
bool get_datatype_info_c::is_ANY_STRING(symbol_c *type_symbol) {
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1327
  if (type_symbol == NULL)                                     {return false;}
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1328
  if (typeid(*type_symbol) == typeid(string_type_name_c))      {return true;}
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1329
  if (typeid(*type_symbol) == typeid(wstring_type_name_c))     {return true;}
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1330
  return false;
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1331
}
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1332
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1333
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1334
bool get_datatype_info_c::is_ANY_SAFESTRING(symbol_c *type_symbol) {
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1335
  if (type_symbol == NULL)                                     {return false;}
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1336
  if (typeid(*type_symbol) == typeid(safestring_type_name_c))  {return true;}
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1337
  if (typeid(*type_symbol) == typeid(safewstring_type_name_c)) {return true;}
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1338
  return false;
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1339
}
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1340
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1341
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1342
bool get_datatype_info_c::is_ANY_STRING_compatible(symbol_c *type_symbol) {
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1343
  if (type_symbol == NULL)                                     {return false;}
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1344
  if (is_ANY_STRING    (type_symbol))                          {return true;}
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1345
  if (is_ANY_SAFESTRING(type_symbol))                          {return true;}
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1346
  return false;
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1347
}
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1348
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1349
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1350
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1351
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1352
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1353
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1354
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1355
/* Can't we do away with this?? */
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1356
bool get_datatype_info_c::is_ANY_REAL_literal(symbol_c *type_symbol) {
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1357
  if (type_symbol == NULL)                              {return true;} /* Please make sure things will work correctly before changing this to false!! */
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1358
  if (typeid(*type_symbol) == typeid(real_c))           {return true;}
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1359
  if (typeid(*type_symbol) == typeid(neg_real_c))       {return true;}
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1360
  return false;
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1361
}
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1362
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1363
/* Can't we do away with this?? */
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1364
bool get_datatype_info_c::is_ANY_INT_literal(symbol_c *type_symbol) {
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1365
  if (type_symbol == NULL)                              {return true;} /* Please make sure things will work correctly before changing this to false!! */
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1366
  if (typeid(*type_symbol) == typeid(integer_c))        {return true;}
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1367
  if (typeid(*type_symbol) == typeid(neg_integer_c))    {return true;}
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1368
  if (typeid(*type_symbol) == typeid(binary_integer_c)) {return true;}
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1369
  if (typeid(*type_symbol) == typeid(octal_integer_c))  {return true;}
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1370
  if (typeid(*type_symbol) == typeid(hex_integer_c))    {return true;}
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1371
  return false;
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1372
}
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1373
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
  1374
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
  1375
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
  1376
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
  1377
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
  1378
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
  1379
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
  1380
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
  1381
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
  1382
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
  1383
invalid_type_name_c      get_datatype_info_c::invalid_type_name;
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
  1384
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
  1385
/**********************/
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
  1386
/* B.1.3 - Data types */
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
  1387
/**********************/
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
  1388
/***********************************/
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
  1389
/* B 1.3.1 - Elementary Data Types */
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
  1390
/***********************************/
699
0307fa16db3f Fix typo.
Mario de Sousa <msousa@fe.up.pt>
parents: 695
diff changeset
  1391
lreal_type_name_c        get_datatype_info_c::lreal_type_name;
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
  1392
real_type_name_c         get_datatype_info_c::real_type_name;
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
  1393
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
  1394
lint_type_name_c         get_datatype_info_c::lint_type_name;
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
  1395
dint_type_name_c         get_datatype_info_c::dint_type_name;
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
  1396
int_type_name_c          get_datatype_info_c::int_type_name;
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
  1397
sint_type_name_c         get_datatype_info_c::sint_type_name;
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
  1398
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
  1399
ulint_type_name_c        get_datatype_info_c::ulint_type_name;
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
  1400
udint_type_name_c        get_datatype_info_c::udint_type_name;
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
  1401
uint_type_name_c         get_datatype_info_c::uint_type_name;
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
  1402
usint_type_name_c        get_datatype_info_c::usint_type_name;
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
  1403
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
  1404
lword_type_name_c        get_datatype_info_c::lword_type_name;
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
  1405
dword_type_name_c        get_datatype_info_c::dword_type_name;
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
  1406
word_type_name_c         get_datatype_info_c::word_type_name;
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
  1407
byte_type_name_c         get_datatype_info_c::byte_type_name;
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
  1408
bool_type_name_c         get_datatype_info_c::bool_type_name;
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
  1409
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
  1410
wstring_type_name_c      get_datatype_info_c::wstring_type_name;
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
  1411
string_type_name_c       get_datatype_info_c::string_type_name;
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
  1412
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
  1413
dt_type_name_c           get_datatype_info_c::dt_type_name;
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
  1414
date_type_name_c         get_datatype_info_c::date_type_name;
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
  1415
tod_type_name_c          get_datatype_info_c::tod_type_name;
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
  1416
time_type_name_c         get_datatype_info_c::time_type_name;
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
  1417
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
  1418
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
  1419
/******************************************************/
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
  1420
/* Extensions to the base standard as defined in      */
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
  1421
/* "Safety Software Technical Specification,          */
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
  1422
/*  Part 1: Concepts and Function Blocks,             */
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
  1423
/*  Version 1.0 – Official Release"                   */
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
  1424
/* by PLCopen - Technical Committee 5 - 2006-01-31    */
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
  1425
/******************************************************/  
699
0307fa16db3f Fix typo.
Mario de Sousa <msousa@fe.up.pt>
parents: 695
diff changeset
  1426
safelreal_type_name_c    get_datatype_info_c::safelreal_type_name;
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
  1427
safereal_type_name_c     get_datatype_info_c::safereal_type_name;
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
  1428
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
  1429
safelint_type_name_c     get_datatype_info_c::safelint_type_name;
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
  1430
safedint_type_name_c     get_datatype_info_c::safedint_type_name;
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
  1431
safeint_type_name_c      get_datatype_info_c::safeint_type_name;
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
  1432
safesint_type_name_c     get_datatype_info_c::safesint_type_name;
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
  1433
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
  1434
safeulint_type_name_c    get_datatype_info_c::safeulint_type_name;
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
  1435
safeudint_type_name_c    get_datatype_info_c::safeudint_type_name;
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
  1436
safeuint_type_name_c     get_datatype_info_c::safeuint_type_name;
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
  1437
safeusint_type_name_c    get_datatype_info_c::safeusint_type_name;
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
  1438
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
  1439
safelword_type_name_c    get_datatype_info_c::safelword_type_name;
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
  1440
safedword_type_name_c    get_datatype_info_c::safedword_type_name;
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
  1441
safeword_type_name_c     get_datatype_info_c::safeword_type_name;
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
  1442
safebyte_type_name_c     get_datatype_info_c::safebyte_type_name;
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
  1443
safebool_type_name_c     get_datatype_info_c::safebool_type_name;
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
  1444
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
  1445
safewstring_type_name_c  get_datatype_info_c::safewstring_type_name;
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
  1446
safestring_type_name_c   get_datatype_info_c::safestring_type_name;
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
  1447
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
  1448
safedt_type_name_c       get_datatype_info_c::safedt_type_name;
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
  1449
safedate_type_name_c     get_datatype_info_c::safedate_type_name;
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
  1450
safetod_type_name_c      get_datatype_info_c::safetod_type_name;
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
  1451
safetime_type_name_c     get_datatype_info_c::safetime_type_name;
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
  1452
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
  1453
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
  1454
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
  1455
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
  1456