absyntax_utils/get_datatype_info.cc
author mjsousa
Sun, 19 Oct 2014 21:30:58 +0100
changeset 938 31e3b3f2eff1
parent 929 469de0f54b0e
child 939 5074236fb3c4
permissions -rw-r--r--
Do the full fill_candidate/narrow_datatype algorithm for all fields of a structured variable in the fill_candidate_datatypes_c
Allows us to remove temporary code from the search_varfb_decl_c
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
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    46
#include "../main.hh" // required for ERROR() and ERROR_MSG() macros.
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
     */ 
727
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
   152
    
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;}
727
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
   158
}; // 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
   159
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
   160
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
   161
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
   162
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
   163
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
   164
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
   165
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
   166
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
   167
/**************************************************/
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
   168
/**************************************************/
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
   169
/* 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
   170
/**************************************************/
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
/**************************************************/
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
   172
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
   173
/* 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
   174
 * 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
   175
 */
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
   176
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
   177
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
   178
  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
   179
     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
   180
    ~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
   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
  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
   183
    /* 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
   184
    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
   185
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
  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
   187
    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
   188
      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
   189
      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
   190
      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
   191
      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
   192
      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
   193
    }
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
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
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
    /*************************/
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
    /* 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
   198
    /*************************/
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
    /* 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
   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
    void *visit(identifier_c *symbol) {return (void *)symbol->value;};
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
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
    /* 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
   206
    /***********************************/
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
    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
   208
    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
   209
    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
   210
    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
   211
    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
   212
    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
   213
    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
   214
    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
   215
    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
   216
    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
   217
    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
   218
    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
   219
    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
   220
    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
   221
    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
   222
    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
   223
    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
   224
    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
   225
    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
   226
    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
   227
    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
   228
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(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
   230
    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
   231
    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
   232
    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
   233
    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
   234
    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
   235
    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
   236
    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
   237
    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
   238
    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
   239
    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
   240
    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
   241
    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
   242
    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
   243
    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
   244
    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
   245
    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
   246
    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
   247
    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
   248
    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
   249
    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
   250
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
    /********************************/
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
    /* 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
   253
    /********************************/
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
    /*  simple_type_name ':' simple_spec_init */
909
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   255
    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
   256
    /*  subrange_type_name ':' subrange_spec_init */
909
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   257
    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
   258
    /*  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
   259
    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
   260
    /*  identifier ':' array_spec_init */
909
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   261
    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
   262
    /*  structure_type_name ':' structure_specification */
909
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   263
    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
   264
    /*  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
   265
    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
   266
    /* ref_type_decl: identifier ':' ref_spec_init */
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   267
    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
   268
    /* 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
   269
     *       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
   270
     *       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
   271
     *       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
   272
     */ 
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
    
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
   274
    /*****************************/
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
    /* 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
   276
    /*****************************/
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
    /*  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
   278
    void *visit(function_block_declaration_c  *symbol)  {return symbol->fblock_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
   279
};
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
   280
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
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
   282
727
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
   283
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
   284
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
   285
/*********************************************************/
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
   286
/*********************************************************/
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
   287
/* 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
   288
/*********************************************************/
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
   289
/*********************************************************/
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
   290
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
   291
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
   292
  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
   293
    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
   294
    /* 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
   295
    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
   296
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
   297
  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
   298
    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
   299
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
   300
    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
   301
      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
   302
      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
   303
      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
   304
      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
   305
    }
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
   306
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
   307
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
   308
  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
   309
    /*************************/
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
   310
    /* 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
   311
    /*************************/
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
   312
    /********************************/
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
   313
    /* 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
   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
    /*  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
   316
    /* 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
   317
    /* 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
   318
    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
   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
    /* 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
   321
    /* 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
   322
    // 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
   323
    /* 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
   324
    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
   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
    /* 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
   327
    /* 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
   328
    /* 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
   329
    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
   330
      /* 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
   331
      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
   332
        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
   333
        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
   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
      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
   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
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
    /*  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
   339
    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
   340
      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
   341
        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
   342
      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
   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
      
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
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
    /* 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
   347
    /* 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
   348
    /* 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
   349
    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
   350
    /*  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
   351
    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
   352
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
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
    /* 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
   356
    /**************************************/
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
    /*****************************/
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
    /* 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
   359
    /*****************************/
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
    /*  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
   361
    // 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
   362
    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
   363
      /* 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
   364
      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
   365
      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
   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
      
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
    /*********************************************/
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
    /* 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
   370
    /*********************************************/
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
    /* 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
   372
    // 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
   373
    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
   374
      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
   375
      /* 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
   376
      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
   377
      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
   378
      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
   379
    }
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
      
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
    /* 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
   382
    // 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
   383
    /* 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
   384
    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
   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
}; // 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
   387
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
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
   389
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
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
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
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
727
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
   394
/**********************************************************/
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
   395
/**********************************************************/
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
   396
/**********************************************************/
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
   397
/*****                                                *****/
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
   398
/*****                                                *****/
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
   399
/*****        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
   400
/*****                                                *****/
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
   401
/*****                                                *****/
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
   402
/**********************************************************/
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
   403
/**********************************************************/
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
   404
/**********************************************************/
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
   405
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
   406
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
   407
  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
   408
}
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
   409
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
   410
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
   411
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
   412
  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
   413
}
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
   414
676
ca4f17211251 Move is_datatype_valid/equal() to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 668
diff changeset
   415
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
   416
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
   417
  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
   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
922
1ba7a814098d Update some comments. (No changes to code)
mjsousa
parents: 921
diff changeset
   420
/* Returns true if both datatypes are equivalent (not necessarily equal!).
1ba7a814098d Update some comments. (No changes to code)
mjsousa
parents: 921
diff changeset
   421
 * 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
   422
 *          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
   423
 *          datatype (or a REF_TO a generic datatype). 
1ba7a814098d Update some comments. (No changes to code)
mjsousa
parents: 921
diff changeset
   424
 *          (Generic dataypes: ANY, ANY_INT, ANY_NUM, ...)
1ba7a814098d Update some comments. (No changes to code)
mjsousa
parents: 921
diff changeset
   425
 * NOTE: Currently only the ANY generic datatype is implemented!
1ba7a814098d Update some comments. (No changes to code)
mjsousa
parents: 921
diff changeset
   426
 * 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
   427
 *       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
   428
 *       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
   429
 */
929
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   430
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   431
/* NOTE: Currently the datatype model used by matiec considers any implicitly defined datatype
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   432
 *       (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
   433
 *       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
   434
 *       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
   435
 *       e.g.
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   436
 *         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
   437
 *         FUNCTION_BLOCK FOO
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   438
 *          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
   439
 *         ...
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   440
 *         END_FUNCTION_BLOCK
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   441
 * 
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   442
 *         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
   443
 * 
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   444
 *       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
   445
 *       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
   446
 *       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
   447
 *        (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
   448
 *              (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
   449
 *        (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
   450
 *              (I dont think the standard says anything about this!)
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   451
 *
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   452
 *         TYPE 
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   453
 *          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
   454
 *          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
   455
 *          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
   456
 *          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
   457
 *          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
   458
 *          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
   459
 *         END_TYPE;
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   460
 *                 
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   461
 *         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
   462
 *           (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
   463
 *           (following rule (0))
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   464
 *         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
   465
 *           (following rule (1))
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   466
 *         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
   467
 *           (following rule (2))
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   468
 *         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
   469
 *           (following rule (1))
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   470
 *
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   471
 *       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
   472
 *       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
   473
 *         FUNCTION_BLOCK FOO
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   474
 *          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
   475
 *         ...
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   476
 *         END_FUNCTION_BLOCK
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   477
 *
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   478
 *       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
   479
 *       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
   480
 *       'incompatible datatypes' error!
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   481
 *       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
   482
 * 
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   483
 *       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
   484
 *         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
   485
 *         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
   486
 *          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
   487
 *         ...
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   488
 *         END_FUNCTION_BLOCK
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
 *         FUNCTION_BLOCK BAR
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   491
 *          VAR
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   492
 *            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
   493
 *            foo: FOO_t;
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   494
 *          END_VAR
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   495
 *          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
   496
 *         ...
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   497
 *         END_FUNCTION_BLOCK
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   498
 * 
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   499
 *       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
   500
 *       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
   501
 *       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
   502
 *       REF() operator would be essentially useless.
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   503
 */
676
ca4f17211251 Move is_datatype_valid/equal() to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 668
diff changeset
   504
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
   505
  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
   506
  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
   507
d228aaa4d616 Introduce absyntax class for keyword ANY, and use REF_TO(ANY) as datatype of NULL literal.
mjsousa
parents: 919
diff changeset
   508
  /* GENERIC DATATYPES */
d228aaa4d616 Introduce absyntax class for keyword ANY, and use REF_TO(ANY) as datatype of NULL literal.
mjsousa
parents: 919
diff changeset
   509
  /* 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
   510
  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
   511
      (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
   512
      
909
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   513
  /* ANY_ELEMENTARY */
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   514
  if ((is_ANY_ELEMENTARY(first_type)) &&
695
5760f1043ba4 Code formating only.
Mario de Sousa <msousa@fe.up.pt>
parents: 693
diff changeset
   515
      (typeid(*first_type) == typeid(*second_type)))                 {return true;}
909
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   516
695
5760f1043ba4 Code formating only.
Mario de Sousa <msousa@fe.up.pt>
parents: 693
diff changeset
   517
  /* ANY_DERIVED */
919
8da635655f37 Add support for the 'NULL' keyword, defined in version 3 of IEC 61131-3.
mjsousa
parents: 909
diff changeset
   518
  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
   519
    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
   520
                         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
   521
  }
695
5760f1043ba4 Code formating only.
Mario de Sousa <msousa@fe.up.pt>
parents: 693
diff changeset
   522
  return (first_type == second_type);
676
ca4f17211251 Move is_datatype_valid/equal() to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 668
diff changeset
   523
}
ca4f17211251 Move is_datatype_valid/equal() to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 668
diff changeset
   524
ca4f17211251 Move is_datatype_valid/equal() to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 668
diff changeset
   525
ca4f17211251 Move is_datatype_valid/equal() to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 668
diff changeset
   526
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
   527
  if (NULL == type)                                                  {return false;}
5760f1043ba4 Code formating only.
Mario de Sousa <msousa@fe.up.pt>
parents: 693
diff changeset
   528
  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
   529
  return true;
ca4f17211251 Move is_datatype_valid/equal() to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 668
diff changeset
   530
}
ca4f17211251 Move is_datatype_valid/equal() to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 668
diff changeset
   531
ca4f17211251 Move is_datatype_valid/equal() to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 668
diff changeset
   532
ca4f17211251 Move is_datatype_valid/equal() to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 668
diff changeset
   533
ca4f17211251 Move is_datatype_valid/equal() to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 668
diff changeset
   534
ca4f17211251 Move is_datatype_valid/equal() to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 668
diff changeset
   535
ca4f17211251 Move is_datatype_valid/equal() to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 668
diff changeset
   536
909
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   537
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   538
/* 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
   539
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
   540
  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
   541
  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
   542
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   543
  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
   544
  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
   545
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   546
  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
   547
  if (NULL != type3) return type3->type_name;
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   548
  
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   549
  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
   550
}
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   551
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   552
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   553
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   554
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   555
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   556
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   557
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
   558
  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
   559
  if (NULL == type_decl)                                                       {return false;}
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   560
  
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   561
  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
   562
  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
   563
  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
   564
  return false;
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   565
}
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   566
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   567
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   568
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   569
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
   570
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
   571
  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
   572
  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
   573
  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
   574
  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
   575
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   576
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   577
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   578
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   579
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
   580
  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
   581
  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
   582
  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
   583
  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
   584
  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
   585
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   586
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   587
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   588
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   589
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   590
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
   591
  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
   592
  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
   593
  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
   594
  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
   595
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   596
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   597
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   598
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   599
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   600
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   601
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
   602
  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
   603
  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
   604
  
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   605
  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
   606
  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
   607
  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
   608
    
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   609
  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
   610
  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
   611
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   612
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   613
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   614
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   615
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   616
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   617
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
   618
  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
   619
  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
   620
  
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   621
  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
   622
  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
   623
  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
   624
  
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   625
  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
   626
  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
   627
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   628
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   629
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   630
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   631
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   632
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   633
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
   634
  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
   635
  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
   636
  
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   637
  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
   638
  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
   639
  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
   640
  
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   641
  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
   642
  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
   643
  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
   644
  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
   645
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   646
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   647
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   648
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   649
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   650
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   651
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
   652
  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
   653
  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
   654
  
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   655
  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
   656
  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
   657
  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
   658
  
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   659
  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
   660
  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
   661
  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
   662
  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
   663
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   664
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   665
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   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
   667
921
d228aaa4d616 Introduce absyntax class for keyword ANY, and use REF_TO(ANY) as datatype of NULL literal.
mjsousa
parents: 919
diff changeset
   668
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
   669
  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
   670
  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
   671
  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
   672
  return false;
d228aaa4d616 Introduce absyntax class for keyword ANY, and use REF_TO(ANY) as datatype of NULL literal.
mjsousa
parents: 919
diff changeset
   673
}
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
   674
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   675
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   676
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
   677
  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
   678
  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
   679
  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
   680
  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
   681
  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
   682
  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
   683
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   684
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   685
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   686
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
   687
  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
   688
  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
   689
  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
   690
  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
   691
  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
   692
  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
   693
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   694
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   695
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   696
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
   697
  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
   698
  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
   699
  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
   700
  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
   701
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   702
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   703
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   704
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   705
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   706
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   707
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   708
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   709
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
   710
  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
   711
  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
   712
  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
   713
  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
   714
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   715
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   716
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   717
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
   718
  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
   719
  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
   720
  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
   721
  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
   722
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   723
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   724
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   725
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
   726
  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
   727
  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
   728
  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
   729
  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
   730
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   731
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   732
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   733
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   734
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   735
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   736
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   737
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   738
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
   739
  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
   740
  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
   741
  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
   742
  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
   743
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   744
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
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   746
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
   747
  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
   748
  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
   749
  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
   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
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
   754
  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
   755
  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
   756
  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
   757
  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
   758
}
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
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
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   766
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
   767
  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
   768
  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
   769
  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
   770
  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
   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
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
   775
  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
   776
  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
   777
  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
   778
  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
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
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
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
   783
  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
   784
  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
   785
  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
   786
  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
   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
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   793
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   794
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   795
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
   796
  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
   797
  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
   798
  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
   799
  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
   800
}
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
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
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
   804
  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
   805
  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
   806
  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
   807
  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
   808
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   809
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   810
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
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
   812
  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
   813
  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
   814
  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
   815
  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
   816
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   817
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   818
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
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
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
   825
  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
   826
  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
   827
  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
   828
  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
   829
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   830
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   831
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   832
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
   833
  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
   834
  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
   835
  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
   836
  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
   837
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   838
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
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
   841
  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
   842
  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
   843
  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
   844
  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
   845
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   846
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   847
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   848
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   849
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   850
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
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
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
   853
  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
   854
  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
   855
  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
   856
  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
   857
  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
   858
  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
   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
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
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
   863
  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
   864
  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
   865
  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
   866
  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
   867
  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
   868
  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
   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
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
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
   873
  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
   874
  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
   875
  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
   876
  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
   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
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
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   886
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
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
   888
  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
   889
  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
   890
  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
   891
  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
   892
  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
   893
  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
   894
}
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
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
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
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
   898
  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
   899
  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
   900
  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
   901
  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
   902
  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
   903
  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
   904
}
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
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
   908
  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
   909
  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
   910
  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
   911
  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
   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
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
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
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
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
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_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
   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(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
   924
  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
   925
  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
   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
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
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
   930
  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
   931
  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
   932
  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
   933
  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
   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
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
   938
  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
   939
  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
   940
  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
   941
  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
   942
}
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
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
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
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
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   950
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   951
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
   952
  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
   953
  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
   954
  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
   955
  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
   956
  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
   957
  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
   958
}
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
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   960
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   961
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
   962
  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
   963
  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
   964
  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
   965
  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
   966
  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
   967
  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
   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
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
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
   972
  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
   973
  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
   974
  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
   975
  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
   976
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   977
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   978
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   979
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   980
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   981
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   982
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   983
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
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
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
   988
  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
   989
  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
   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
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
   995
  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
   996
  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
   997
  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
   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
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
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
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
  1002
  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
  1003
  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
  1004
  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
  1005
  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
  1006
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1007
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1008
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1009
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1010
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1011
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1012
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
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
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
  1017
  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
  1018
  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
  1019
  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
  1020
  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
  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
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
  1025
  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
  1026
  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
  1027
  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
  1028
  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
}
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
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
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
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
  1033
  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
  1034
  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
  1035
  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
  1036
  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
  1037
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1038
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1039
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
  1040
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
  1041
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
  1042
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
  1043
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
  1044
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
  1045
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
  1046
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
  1047
  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
  1048
  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
  1049
  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
  1050
}
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
  1051
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
  1052
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
  1053
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
  1054
  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
  1055
  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
  1056
  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
  1057
}
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
  1058
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
  1059
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
  1060
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
  1061
  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
  1062
  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
  1063
  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
  1064
  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
  1065
}
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
  1066
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
  1067
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
  1068
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
  1069
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
  1070
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
  1071
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
  1072
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
  1073
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
  1074
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
  1075
  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
  1076
  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
  1077
  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
  1078
  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
  1079
  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
  1080
}
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
  1081
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
  1082
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
  1083
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
  1084
  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
  1085
  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
  1086
  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
  1087
  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
  1088
  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
  1089
}
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
  1090
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
  1091
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
  1092
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
  1093
  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
  1094
  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
  1095
  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
  1096
  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
  1097
}
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
  1098
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
  1099
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
  1100
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
  1101
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
  1102
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
  1103
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
  1104
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
  1105
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
  1106
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
  1107
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
  1108
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
  1109
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
  1110
  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
  1111
  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
  1112
  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
  1113
  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
  1114
}
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
  1115
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
  1116
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
  1117
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
  1118
  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
  1119
  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
  1120
  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
  1121
  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
  1122
}
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
  1123
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
  1124
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
  1125
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
  1126
  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
  1127
  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
  1128
  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
  1129
  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
  1130
}
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
  1131
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
  1132
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
  1133
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
  1134
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
  1135
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
  1136
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
  1137
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
  1138
/* 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
  1139
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
  1140
  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
  1141
  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
  1142
  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
  1143
  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
  1144
}
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
  1145
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
  1146
/* 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
  1147
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
  1148
  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
  1149
  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
  1150
  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
  1151
  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
  1152
  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
  1153
  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
  1154
  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
  1155
}
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
  1156
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
  1157
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
  1158
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
  1159
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
  1160
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
  1161
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
  1162
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
  1163
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
  1164
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
  1165
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
  1166
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
  1167
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
  1168
/**********************/
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
  1169
/* 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
  1170
/**********************/
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
  1171
/***********************************/
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
  1172
/* 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
  1173
/***********************************/
699
0307fa16db3f Fix typo.
Mario de Sousa <msousa@fe.up.pt>
parents: 695
diff changeset
  1174
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
  1175
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
  1176
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
  1177
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
  1178
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
  1179
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
  1180
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
  1181
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
  1182
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
  1183
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
  1184
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
  1185
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
  1186
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
  1187
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
  1188
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
  1189
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
  1190
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
  1191
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
  1192
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
  1193
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
  1194
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
  1195
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
  1196
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
  1197
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
  1198
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
  1199
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
  1200
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
  1201
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
  1202
/******************************************************/
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
  1203
/* 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
  1204
/* "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
  1205
/*  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
  1206
/*  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
  1207
/* 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
  1208
/******************************************************/  
699
0307fa16db3f Fix typo.
Mario de Sousa <msousa@fe.up.pt>
parents: 695
diff changeset
  1209
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
  1210
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
  1211
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
  1212
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
  1213
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
  1214
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
  1215
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
  1216
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
  1217
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
  1218
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
  1219
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
  1220
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
  1221
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
  1222
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
  1223
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
  1224
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
  1225
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
  1226
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
  1227
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
  1228
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
  1229
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
  1230
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
  1231
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
  1232
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
  1233
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
  1234
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
  1235
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
  1236
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
  1237
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
  1238
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
  1239