absyntax_utils/get_datatype_info.cc
author mjsousa
Sat, 06 Dec 2014 19:11:32 +0000
changeset 958 7474d2cd1d6e
parent 946 c012a64dc2fa
child 986 2064a22cc1f2
permissions -rw-r--r--
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
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
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   626
 */
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   627
#include <string.h>  /* required for strlen() */
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   628
static std::string normalize_integer(symbol_c *symbol) {
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   629
  integer_c *token = dynamic_cast<integer_c *>(symbol);
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   630
  if (NULL == token) ERROR;
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   631
  
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   632
  std::string str = "";
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   633
  bool leading_zero = true;
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   634
  unsigned int offset = 0;
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   635
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   636
  // handle any possible leading '-' or '+'
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   637
  if        (token->value[0] == '-') {
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   638
      //    '-' -> retained
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   639
      str += token->value[0];
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   640
      offset++;
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   641
  } else if (token->value[0] == '+')
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   642
      //    '+' -> skip, so '+8' and '8' will both result in '8'
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   643
      offset++;
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   644
    
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   645
  for (unsigned int i = offset; i < strlen(token->value); i++) {
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   646
    if (leading_zero && (token->value[i] != '0'))
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   647
      leading_zero = false;
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   648
    if (!leading_zero && token->value[i] != '_')
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   649
      str += token->value[i];
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   650
  }
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   651
  return str;
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   652
}
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   653
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   654
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   655
/* 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
   656
 *  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
   657
 */
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   658
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
   659
  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
   660
  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
   661
  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
   662
  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
   663
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   664
  // are they both array datatypes? 
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   665
  if ((NULL == array_1) || (NULL == array_2))
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   666
    return false;
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   667
  
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   668
  // number of subranges
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   669
  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
   670
  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
   671
  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
   672
  if (subrange_list_1->n != subrange_list_2->n)
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   673
    return false;
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   674
  
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   675
  // comparison of each subrange start and end elements
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   676
  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
   677
    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
   678
    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
   679
    if ((NULL == subrange_1) || (NULL == subrange_2)) ERROR;
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   680
    #if 0
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   681
    /* An alternative method of checking whether the subranges have the same values, using the result of the constant folding agorithm.
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   682
     * 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
   683
     *  the get_datatype_info_c::is_type_equal() method is called.
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   684
     * The probably slower alternative of comparing the strings themselves is therefor used.
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   685
     */
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   686
    if (!constant_folding_c::is_equal_cvalue(subrange_1->lower_limit, subrange_2->lower_limit)) return false;
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   687
    if (!constant_folding_c::is_equal_cvalue(subrange_1->upper_limit, subrange_2->upper_limit)) return false;
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   688
    #endif
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   689
    if (normalize_integer(subrange_1->lower_limit) != normalize_integer(subrange_2->lower_limit)) return false;
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   690
    if (normalize_integer(subrange_1->upper_limit) != normalize_integer(subrange_2->upper_limit)) return false;
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   691
  }
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
  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
   694
                       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
   695
}
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   696
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   697
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 939
diff changeset
   698
676
ca4f17211251 Move is_datatype_valid/equal() to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 668
diff changeset
   699
ca4f17211251 Move is_datatype_valid/equal() to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 668
diff changeset
   700
ca4f17211251 Move is_datatype_valid/equal() to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 668
diff changeset
   701
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
   702
  if (NULL == type)                                                  {return false;}
5760f1043ba4 Code formating only.
Mario de Sousa <msousa@fe.up.pt>
parents: 693
diff changeset
   703
  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
   704
  return true;
ca4f17211251 Move is_datatype_valid/equal() to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 668
diff changeset
   705
}
ca4f17211251 Move is_datatype_valid/equal() to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 668
diff changeset
   706
ca4f17211251 Move is_datatype_valid/equal() to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 668
diff changeset
   707
ca4f17211251 Move is_datatype_valid/equal() to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 668
diff changeset
   708
ca4f17211251 Move is_datatype_valid/equal() to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 668
diff changeset
   709
ca4f17211251 Move is_datatype_valid/equal() to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 668
diff changeset
   710
ca4f17211251 Move is_datatype_valid/equal() to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 668
diff changeset
   711
909
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   712
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   713
/* 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
   714
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
   715
  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
   716
  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
   717
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   718
  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
   719
  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
   720
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   721
  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
   722
  if (NULL != type3) return type3->type_name;
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   723
  
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   724
  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
   725
}
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   726
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   727
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   728
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   729
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   730
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   731
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   732
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
   733
  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
   734
  if (NULL == type_decl)                                                       {return false;}
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   735
  
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   736
  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
   737
  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
   738
  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
   739
  return false;
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   740
}
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   741
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   742
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   743
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   744
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
   745
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
   746
  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
   747
  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
   748
  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
   749
  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
   750
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   751
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   752
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   753
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   754
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
   755
  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
   756
  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
   757
  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
   758
  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
   759
  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
   760
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   761
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   762
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   763
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   764
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   765
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
   766
  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
   767
  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
   768
  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
   769
  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
   770
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   771
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   772
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   773
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   774
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   775
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   776
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
   777
  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
   778
  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
   779
  
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   780
  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
   781
  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
   782
  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
   783
    
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   784
  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
   785
  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
   786
}
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
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   788
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   789
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
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
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
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
   793
  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
   794
  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
   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
  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
   797
  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
   798
  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
   799
  
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(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
   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
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   808
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
   809
  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
   810
  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
   811
  
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
  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
   813
  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
   814
  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
   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
  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
   817
  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
   818
  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
   819
  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
   820
}
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
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
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
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
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
   827
  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
   828
  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
   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
  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
   831
  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
   832
  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
   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
  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
   835
  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
   836
  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
   837
  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
   838
}
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
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
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
921
d228aaa4d616 Introduce absyntax class for keyword ANY, and use REF_TO(ANY) as datatype of NULL literal.
mjsousa
parents: 919
diff changeset
   843
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
   844
  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
   845
  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
   846
  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
   847
  return false;
d228aaa4d616 Introduce absyntax class for keyword ANY, and use REF_TO(ANY) as datatype of NULL literal.
mjsousa
parents: 919
diff changeset
   848
}
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
   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
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   851
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
   852
  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
   853
  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
   854
  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
   855
  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
   856
  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
   857
  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
   858
}
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
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
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
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
   862
  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
   863
  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
   864
  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
   865
  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
   866
  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
   867
  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
   868
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   869
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   870
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
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
   872
  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
   873
  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
   874
  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
   875
  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
   876
}
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
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
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
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
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
   885
  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
   886
  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
   887
  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
   888
  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
   889
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   890
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
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
   893
  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
   894
  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
   895
  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
   896
  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
   897
}
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
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
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
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
   901
  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
   902
  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
   903
  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
   904
  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
}
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
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
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
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
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_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
   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 (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
   916
  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
   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
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
   922
  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
   923
  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
   924
  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
   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
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
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   928
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
   929
  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
   930
  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
   931
  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
   932
  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
   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
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
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   936
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
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
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
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
   942
  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
   943
  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
   944
  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
   945
  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
   946
}
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
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
   950
  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
   951
  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
   952
  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
   953
  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
   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
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
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
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
   958
  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
   959
  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
   960
  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
   961
  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
   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
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
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
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
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_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
   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_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
   973
  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
   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
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
   979
  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
   980
  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
   981
  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
   982
  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
   983
}
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
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
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
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
   987
  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
   988
  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
   989
  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
   990
  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
   991
}
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
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
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
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   995
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_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
  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_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
  1002
  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
  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
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
  1008
  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
  1009
  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
  1010
  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
  1011
  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
  1012
}
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
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
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
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
  1016
  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
  1017
  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
  1018
  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
  1019
  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
  1020
}
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
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
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
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1024
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
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
  1028
  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
  1029
  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
  1030
  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
  1031
  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
  1032
  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
  1033
  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
  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
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
  1038
  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
  1039
  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
  1040
  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
  1041
  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
  1042
  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
  1043
  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
  1044
}
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
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
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
  1048
  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
  1049
  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
  1050
  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
  1051
  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
  1052
}
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
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
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
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
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
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
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
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
  1063
  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
  1064
  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
  1065
  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
  1066
  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
  1067
  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
  1068
  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
  1069
}
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
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
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
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
  1073
  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
  1074
  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
  1075
  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
  1076
  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
  1077
  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
  1078
  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
  1079
}
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
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
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
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
  1083
  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
  1084
  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
  1085
  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
  1086
  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
  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
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
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
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
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
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
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
  1097
  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
  1098
  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
  1099
  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
  1100
  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
  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_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
  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(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
  1107
  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
  1108
  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
  1109
}
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
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
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
  1113
  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
  1114
  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
  1115
  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
  1116
  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
  1117
}
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
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
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
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
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
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
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
  1127
  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
  1128
  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
  1129
  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
  1130
  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
  1131
  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
  1132
  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
  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
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
  1137
  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
  1138
  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
  1139
  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
  1140
  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
  1141
  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
  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_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
  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 (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
  1149
  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
  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
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
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
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
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
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
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
  1163
  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
  1164
  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
  1165
  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
  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
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
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
  1170
  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
  1171
  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
  1172
  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
  1173
}
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
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
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
  1177
  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
  1178
  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
  1179
  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
  1180
  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
  1181
}
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
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
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
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
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
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
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
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
  1192
  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
  1193
  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
  1194
  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
  1195
  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
  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
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
  1200
  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
  1201
  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
  1202
  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
  1203
  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
  1204
}
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
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
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
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
  1208
  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
  1209
  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
  1210
  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
  1211
  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
  1212
}
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
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
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
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
  1216
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
  1217
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
  1218
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
  1219
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
  1220
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
  1221
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
  1222
  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
  1223
  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
  1224
  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
  1225
}
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
  1226
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
  1227
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
  1228
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
  1229
  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
  1230
  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
  1231
  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
  1232
}
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
  1233
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
  1234
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
  1235
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
  1236
  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
  1237
  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
  1238
  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
  1239
  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
  1240
}
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
  1241
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
  1242
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
  1243
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
  1244
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
  1245
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
  1246
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
  1247
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
  1248
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
  1249
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
  1250
  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
  1251
  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
  1252
  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
  1253
  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
  1254
  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
  1255
}
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
  1256
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
  1257
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
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
  1259
  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
  1260
  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
  1261
  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
  1262
  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
  1263
  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
  1264
}
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
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
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
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
  1268
  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
  1269
  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
  1270
  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
  1271
  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
}
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
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
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
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
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
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
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
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
  1285
  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
  1286
  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
  1287
  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
  1288
  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
  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
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
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
  1293
  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
  1294
  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
  1295
  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
  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_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
  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 (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
  1303
  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
  1304
  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
  1305
}
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
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
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
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
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
/* 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
  1314
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
  1315
  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
  1316
  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
  1317
  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
  1318
  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
  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
/* 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
  1322
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
  1323
  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
  1324
  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
  1325
  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
  1326
  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
  1327
  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
  1328
  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
  1329
  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
  1330
}
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
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
  1332
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
  1333
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
  1334
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
  1335
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
  1336
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
  1337
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
  1338
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
  1339
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
  1340
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
  1341
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
  1342
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
  1343
/**********************/
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
  1344
/* 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
  1345
/**********************/
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
  1346
/***********************************/
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
  1347
/* 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
  1348
/***********************************/
699
0307fa16db3f Fix typo.
Mario de Sousa <msousa@fe.up.pt>
parents: 695
diff changeset
  1349
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
  1350
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
  1351
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
  1352
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
  1353
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
  1354
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
  1355
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
  1356
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
  1357
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
  1358
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
  1359
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
  1360
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
  1361
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
  1362
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
  1363
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
  1364
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
  1365
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
  1366
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
  1367
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
  1368
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
  1369
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
  1370
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
  1371
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
  1372
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
  1373
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
  1374
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
  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
/* 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
  1379
/* "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
  1380
/*  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
  1381
/*  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
  1382
/* 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
  1383
/******************************************************/  
699
0307fa16db3f Fix typo.
Mario de Sousa <msousa@fe.up.pt>
parents: 695
diff changeset
  1384
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
  1385
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
  1386
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
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
  1388
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
  1389
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
  1390
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
  1391
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
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
  1393
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
  1394
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
  1395
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
  1396
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
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
  1398
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
  1399
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
  1400
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
  1401
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
  1402
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
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
  1404
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
  1405
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
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
  1407
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
  1408
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
  1409
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
  1410
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
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
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