absyntax_utils/get_datatype_info.cc
author mjsousa
Mon, 11 Aug 2014 07:55:11 +0100
changeset 929 469de0f54b0e
parent 922 1ba7a814098d
child 938 31e3b3f2eff1
permissions -rw-r--r--
Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_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
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
    65
/* Return the identifier (name) of a datatype, typically declared in a TYPE .. END_TYPE declaration */
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
    66
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
    67
  private:
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
    68
    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
    69
    
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
    70
  public:
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
    71
    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
    72
      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
    73
      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
    74
      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
    75
    }
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
    76
    
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
    77
  protected:
929
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
    78
    /***********************************/
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
    79
    /* 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
    80
    /***********************************/
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
    81
    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
    82
    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
    83
    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
    84
    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
    85
    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
    86
    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
    87
    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
    88
    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
    89
    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
    90
    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
    91
    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
    92
    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
    93
    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
    94
    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
    95
    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
    96
    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
    97
    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
    98
    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
    99
    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
   100
    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
   101
    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
   102
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   103
    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
   104
    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
   105
    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
   106
    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
   107
    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
   108
    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
   109
    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
   110
    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
   111
    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
   112
    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
   113
    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
   114
    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
   115
    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
   116
    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
   117
    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
   118
    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
   119
    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
   120
    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
   121
    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
   122
    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
   123
    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
   124
727
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
   125
    /********************************/
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
   126
    /* 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
   127
    /********************************/
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
   128
    /*  simple_type_name ':' simple_spec_init */
909
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   129
    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
   130
    /*  subrange_type_name ':' subrange_spec_init */
909
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   131
    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
   132
    /*  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
   133
    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
   134
    /*  identifier ':' array_spec_init */
909
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   135
    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
   136
    /*  structure_type_name ':' structure_specification */
909
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   137
    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
   138
    /*  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
   139
    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
   140
    /* ref_type_decl: identifier ':' ref_spec_init */
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   141
    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
   142
    /* 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
   143
     *       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
   144
     *       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
   145
     *       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
   146
     */ 
727
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
   147
    
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
   148
    /*****************************/
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
   149
    /* 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
   150
    /*****************************/
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
   151
    /*  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
   152
    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
   153
}; // 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
   154
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
   155
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
   156
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
   157
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
   158
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
   159
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
   160
/***********************************************************************/
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   161
/***********************************************************************/
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   162
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   163
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   164
/* 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
   165
 * 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
   166
 */
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   167
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   168
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
   169
  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
   170
     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
   171
    ~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
   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
  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
   174
    /* 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
   175
    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
   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
  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
   178
    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
   179
      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
   180
      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
   181
      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
   182
      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
   183
      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
   184
    }
44e02a88f1e7 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
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   187
    /*************************/
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   188
    /* 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
   189
    /*************************/
44e02a88f1e7 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
    /*******************************************/
44e02a88f1e7 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
    /* 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
   192
    /*******************************************/
44e02a88f1e7 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
    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
   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
    /* 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
   197
    /***********************************/
44e02a88f1e7 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
    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
   199
    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
   200
    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
   201
    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
   202
    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
   203
    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
   204
    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
   205
    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
   206
    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
   207
    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
   208
    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
   209
    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
   210
    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
   211
    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
   212
    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
   213
    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
   214
    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
   215
    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
   216
    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
   217
    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
   218
    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
   219
44e02a88f1e7 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(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
   221
    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
   222
    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
   223
    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
   224
    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
   225
    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
   226
    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
   227
    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
   228
    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
   229
    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
   230
    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
   231
    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
   232
    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
   233
    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
   234
    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
   235
    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
   236
    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
   237
    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
   238
    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
   239
    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
   240
    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
   241
44e02a88f1e7 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
    /********************************/
44e02a88f1e7 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
    /* 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
   244
    /********************************/
44e02a88f1e7 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
    /*  simple_type_name ':' simple_spec_init */
909
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   246
    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
   247
    /*  subrange_type_name ':' subrange_spec_init */
909
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   248
    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
   249
    /*  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
   250
    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
   251
    /*  identifier ':' array_spec_init */
909
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   252
    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
   253
    /*  structure_type_name ':' structure_specification */
909
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   254
    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
   255
    /*  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
   256
    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
   257
    /* ref_type_decl: identifier ':' ref_spec_init */
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   258
    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
   259
    /* 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
   260
     *       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
   261
     *       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
   262
     *       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
   263
     */ 
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
    
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   265
    /*****************************/
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   266
    /* 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
   267
    /*****************************/
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   268
    /*  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
   269
    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
   270
};
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   271
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   272
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
   273
727
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
   274
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
   275
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
   276
/**********************************************************/
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
   277
/**********************************************************/
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
   278
/**********************************************************/
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
   279
/*****                                                *****/
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
   280
/*****                                                *****/
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
   281
/*****        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
   282
/*****                                                *****/
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
/**********************************************************/
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
   285
/**********************************************************/
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
   286
/**********************************************************/
db5881e6facd Add method to determine the id (name) of a datatype.
Mario de Sousa <msousa@fe.up.pt>
parents: 718
diff changeset
   287
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
   288
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
   289
  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
   290
}
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   291
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   292
44e02a88f1e7 moved class to obtain datatype name (in char *) to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 727
diff changeset
   293
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
   294
  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
   295
}
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
   296
676
ca4f17211251 Move is_datatype_valid/equal() to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 668
diff changeset
   297
922
1ba7a814098d Update some comments. (No changes to code)
mjsousa
parents: 921
diff changeset
   298
/* Returns true if both datatypes are equivalent (not necessarily equal!).
1ba7a814098d Update some comments. (No changes to code)
mjsousa
parents: 921
diff changeset
   299
 * 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
   300
 *          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
   301
 *          datatype (or a REF_TO a generic datatype). 
1ba7a814098d Update some comments. (No changes to code)
mjsousa
parents: 921
diff changeset
   302
 *          (Generic dataypes: ANY, ANY_INT, ANY_NUM, ...)
1ba7a814098d Update some comments. (No changes to code)
mjsousa
parents: 921
diff changeset
   303
 * NOTE: Currently only the ANY generic datatype is implemented!
1ba7a814098d Update some comments. (No changes to code)
mjsousa
parents: 921
diff changeset
   304
 * 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
   305
 *       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
   306
 *       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
   307
 */
929
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   308
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   309
/* 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
   310
 *       (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
   311
 *       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
   312
 *       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
   313
 *       e.g.
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   314
 *         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
   315
 *         FUNCTION_BLOCK FOO
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   316
 *          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
   317
 *         ...
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   318
 *         END_FUNCTION_BLOCK
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   319
 * 
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   320
 *         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
   321
 * 
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   322
 *       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
   323
 *       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
   324
 *       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
   325
 *        (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
   326
 *              (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
   327
 *        (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
   328
 *              (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
   329
 *
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   330
 *         TYPE 
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   331
 *          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
   332
 *          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
   333
 *          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
   334
 *          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
   335
 *          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
   336
 *          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
   337
 *         END_TYPE;
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   338
 *                 
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   339
 *         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
   340
 *           (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
   341
 *           (following rule (0))
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   342
 *         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
   343
 *           (following rule (1))
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   344
 *         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
   345
 *           (following rule (2))
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   346
 *         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
   347
 *           (following rule (1))
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   348
 *
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   349
 *       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
   350
 *       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
   351
 *         FUNCTION_BLOCK FOO
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   352
 *          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
   353
 *         ...
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   354
 *         END_FUNCTION_BLOCK
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   355
 *
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   356
 *       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
   357
 *       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
   358
 *       'incompatible datatypes' error!
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   359
 *       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
   360
 * 
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   361
 *       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
   362
 *         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
   363
 *         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
   364
 *          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
   365
 *         ...
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   366
 *         END_FUNCTION_BLOCK
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   367
 * 
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   368
 *         FUNCTION_BLOCK BAR
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   369
 *          VAR
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   370
 *            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
   371
 *            foo: FOO_t;
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   372
 *          END_VAR
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   373
 *          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
   374
 *         ...
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   375
 *         END_FUNCTION_BLOCK
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   376
 * 
469de0f54b0e Add comments, and make get_datatype_id_str_c equivalent to get_datatype_id_c
mjsousa
parents: 922
diff changeset
   377
 *       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
   378
 *       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
   379
 *       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
   380
 *       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
   381
 */
676
ca4f17211251 Move is_datatype_valid/equal() to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 668
diff changeset
   382
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
   383
  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
   384
  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
   385
d228aaa4d616 Introduce absyntax class for keyword ANY, and use REF_TO(ANY) as datatype of NULL literal.
mjsousa
parents: 919
diff changeset
   386
  /* GENERIC DATATYPES */
d228aaa4d616 Introduce absyntax class for keyword ANY, and use REF_TO(ANY) as datatype of NULL literal.
mjsousa
parents: 919
diff changeset
   387
  /* 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
   388
  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
   389
      (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
   390
      
909
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   391
  /* ANY_ELEMENTARY */
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   392
  if ((is_ANY_ELEMENTARY(first_type)) &&
695
5760f1043ba4 Code formating only.
Mario de Sousa <msousa@fe.up.pt>
parents: 693
diff changeset
   393
      (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
   394
695
5760f1043ba4 Code formating only.
Mario de Sousa <msousa@fe.up.pt>
parents: 693
diff changeset
   395
  /* ANY_DERIVED */
919
8da635655f37 Add support for the 'NULL' keyword, defined in version 3 of IEC 61131-3.
mjsousa
parents: 909
diff changeset
   396
  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
   397
    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
   398
                         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
   399
  }
695
5760f1043ba4 Code formating only.
Mario de Sousa <msousa@fe.up.pt>
parents: 693
diff changeset
   400
  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
   401
}
ca4f17211251 Move is_datatype_valid/equal() to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 668
diff changeset
   402
ca4f17211251 Move is_datatype_valid/equal() to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 668
diff changeset
   403
ca4f17211251 Move is_datatype_valid/equal() to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 668
diff changeset
   404
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
   405
  if (NULL == type)                                                  {return false;}
5760f1043ba4 Code formating only.
Mario de Sousa <msousa@fe.up.pt>
parents: 693
diff changeset
   406
  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
   407
  return true;
ca4f17211251 Move is_datatype_valid/equal() to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 668
diff changeset
   408
}
ca4f17211251 Move is_datatype_valid/equal() to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 668
diff changeset
   409
ca4f17211251 Move is_datatype_valid/equal() to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 668
diff changeset
   410
ca4f17211251 Move is_datatype_valid/equal() to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 668
diff changeset
   411
ca4f17211251 Move is_datatype_valid/equal() to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 668
diff changeset
   412
ca4f17211251 Move is_datatype_valid/equal() to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 668
diff changeset
   413
ca4f17211251 Move is_datatype_valid/equal() to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 668
diff changeset
   414
909
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   415
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   416
/* 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
   417
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
   418
  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
   419
  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
   420
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   421
  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
   422
  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
   423
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   424
  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
   425
  if (NULL != type3) return type3->type_name;
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   426
  
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   427
  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
   428
}
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   429
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   430
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   431
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   432
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   433
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   434
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   435
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
   436
  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
   437
  if (NULL == type_decl)                                                       {return false;}
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   438
  
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   439
  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
   440
  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
   441
  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
   442
  return false;
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   443
}
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   444
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   445
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   446
8b2a31dea131 Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents: 858
diff changeset
   447
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
   448
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
   449
  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
   450
  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
   451
  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
   452
  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
   453
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   454
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   455
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   456
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   457
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
   458
  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
   459
  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
   460
  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
   461
  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
   462
  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
   463
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   464
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   465
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   466
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   467
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   468
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
   469
  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
   470
  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
   471
  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
   472
  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
   473
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   474
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   475
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   476
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   477
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   478
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   479
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
   480
  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
   481
  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
   482
  
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   483
  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
   484
  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
   485
  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
   486
    
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   487
  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
   488
  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
   489
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   490
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   491
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   492
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   493
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   494
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   495
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
   496
  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
   497
  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
   498
  
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   499
  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
   500
  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
   501
  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
   502
  
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   503
  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
   504
  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
   505
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   506
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   507
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   508
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   509
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   510
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   511
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
   512
  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
   513
  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
   514
  
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   515
  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
   516
  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
   517
  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
   518
  
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   519
  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
   520
  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
   521
  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
   522
  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
   523
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   524
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   525
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   526
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   527
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   528
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   529
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
   530
  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
   531
  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
   532
  
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   533
  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
   534
  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
   535
  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
   536
  
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   537
  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
   538
  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
   539
  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
   540
  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
   541
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   542
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   543
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   544
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   545
921
d228aaa4d616 Introduce absyntax class for keyword ANY, and use REF_TO(ANY) as datatype of NULL literal.
mjsousa
parents: 919
diff changeset
   546
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
   547
  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
   548
  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
   549
  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
   550
  return false;
d228aaa4d616 Introduce absyntax class for keyword ANY, and use REF_TO(ANY) as datatype of NULL literal.
mjsousa
parents: 919
diff changeset
   551
}
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
   552
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   553
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   554
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
   555
  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
   556
  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
   557
  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
   558
  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
   559
  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
   560
  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
   561
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   562
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   563
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   564
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
   565
  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
   566
  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
   567
  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
   568
  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
   569
  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
   570
  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
   571
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   572
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
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
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
   575
  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
   576
  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
   577
  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
   578
  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
   579
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   580
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   581
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
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
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
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
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
   588
  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
   589
  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
   590
  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
   591
  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
   592
}
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
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
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
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
   596
  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
   597
  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
   598
  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
   599
  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
   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
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   602
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   603
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
   604
  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
   605
  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
   606
  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
   607
  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
   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
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
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
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
   617
  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
   618
  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
   619
  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
   620
  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
   621
}
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
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
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
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
   625
  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
   626
  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
   627
  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
   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
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
   632
  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
   633
  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
   634
  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
   635
  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
   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
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
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
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
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
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
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
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
   645
  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
   646
  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
   647
  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
   648
  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
   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
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   652
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
   653
  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
   654
  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
   655
  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
   656
  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
   657
}
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
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
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
   661
  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
   662
  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
   663
  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
   664
  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
   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
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   668
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   669
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   670
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   671
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   672
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   673
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
   674
  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
   675
  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
   676
  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
   677
  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
}
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
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
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
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
   682
  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
   683
  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
   684
  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
   685
  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
   686
}
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
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
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
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
   690
  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
   691
  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
   692
  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
   693
  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
   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
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
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
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
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
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
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
   703
  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
   704
  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
   705
  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
   706
  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
   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
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
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
   711
  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
   712
  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
   713
  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
   714
  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
   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
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
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
   719
  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
   720
  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
   721
  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
   722
  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
   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
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
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
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
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
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
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
   731
  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
   732
  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
   733
  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
   734
  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
   735
  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
   736
  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
   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
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
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
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
   741
  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
   742
  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
   743
  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
   744
  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
   745
  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
   746
  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
   747
}
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
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
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
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
   751
  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
   752
  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
   753
  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
   754
  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
}
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
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
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
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
   766
  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
   767
  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
   768
  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
   769
  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
   770
  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
   771
  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
   772
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   773
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   774
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   775
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
   776
  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
   777
  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
   778
  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
   779
  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
   780
  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
   781
  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
   782
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   783
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   784
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
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
   786
  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
   787
  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
   788
  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
   789
  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
   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
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
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
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
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
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
   800
  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
   801
  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
   802
  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
   803
  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
   804
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   805
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   806
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   807
bool get_datatype_info_c::is_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
   808
  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
   809
  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
   810
  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
   811
  return false;
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   812
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   813
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   814
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   815
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
   816
  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
   817
  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
   818
  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
   819
  return false;
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   820
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   821
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   822
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   823
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   824
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   825
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   826
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
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   828
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   829
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
   830
  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
   831
  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
   832
  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
   833
  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
   834
  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
   835
  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
   836
}
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
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
   840
  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
   841
  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
   842
  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
   843
  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
   844
  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
   845
  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
   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
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
   850
  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
   851
  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
   852
  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
   853
  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
}
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
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
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   857
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   858
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
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   863
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   864
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   865
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
   866
  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
   867
  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
   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_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
   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 (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
   875
  return false;
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   876
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   877
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   878
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   879
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
   880
  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
   881
  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
   882
  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
   883
  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
   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
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
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   889
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   890
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   891
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   892
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
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
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
   895
  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
   896
  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
   897
  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
   898
  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
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   900
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   901
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   902
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
   903
  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
   904
  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
   905
  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
   906
  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
   907
}
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   908
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   909
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   910
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
   911
  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
   912
  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
   913
  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
   914
  return false;
8ba9ec4bae50 Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   915
}
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
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
   919
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
   920
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
   921
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
   922
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
   923
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
   924
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
   925
  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
   926
  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
   927
  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
   928
}
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
   929
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
   930
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
   931
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
   932
  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
   933
  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
   934
  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
   935
}
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
   936
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
   937
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
   938
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
   939
  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
   940
  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
   941
  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
   942
  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
   943
}
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
   944
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
   945
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
   946
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
   947
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
   948
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
   949
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
   950
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
   951
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
   952
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
   953
  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
   954
  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
   955
  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
   956
  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
   957
  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
   958
}
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
   959
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
   960
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
   961
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
   962
  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
   963
  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
   964
  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
   965
  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
   966
  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
   967
}
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
   968
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
   969
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
   970
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
   971
  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
   972
  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
   973
  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
   974
  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
   975
}
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
   976
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
   977
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
   978
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
   979
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
   980
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
   981
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
   982
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
   983
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
   984
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
   985
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
   986
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
   987
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
   988
  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
   989
  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
   990
  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
   991
  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
   992
}
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
   993
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
   994
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
   995
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
   996
  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
   997
  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
   998
  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
   999
  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
  1000
}
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1001
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1002
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1003
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
  1004
  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
  1005
  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
  1006
  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
  1007
  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
  1008
}
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1009
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1010
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1011
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1012
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1013
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1014
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1015
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1016
/* 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
  1017
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
  1018
  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
  1019
  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
  1020
  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
  1021
  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
  1022
}
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1023
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1024
/* 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
  1025
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
  1026
  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
  1027
  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
  1028
  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
  1029
  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
  1030
  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
  1031
  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
  1032
  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
  1033
}
90b6eb7f1775 Deprecating use of search_expression_type_c, so it may later be deleted!
Mario de Sousa <msousa@fe.up.pt>
parents: 666
diff changeset
  1034
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
  1035
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
  1036
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
  1037
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
  1038
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
  1039
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
  1040
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
  1041
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
  1042
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
  1043
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
  1044
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
  1045
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
  1046
/**********************/
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
  1047
/* 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
  1048
/**********************/
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
  1049
/***********************************/
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
  1050
/* 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
  1051
/***********************************/
699
0307fa16db3f Fix typo.
Mario de Sousa <msousa@fe.up.pt>
parents: 695
diff changeset
  1052
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
  1053
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
  1054
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
  1055
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
  1056
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
  1057
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
  1058
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
  1059
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
  1060
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
  1061
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
  1062
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
  1063
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
  1064
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
  1065
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
  1066
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
  1067
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
  1068
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
  1069
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
  1070
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
  1071
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
  1072
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
  1073
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
  1074
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
  1075
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
  1076
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
  1077
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
  1078
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
  1079
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
  1080
/******************************************************/
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
  1081
/* 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
  1082
/* "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
  1083
/*  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
  1084
/*  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
  1085
/* 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
  1086
/******************************************************/  
699
0307fa16db3f Fix typo.
Mario de Sousa <msousa@fe.up.pt>
parents: 695
diff changeset
  1087
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
  1088
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
  1089
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
  1090
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
  1091
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
  1092
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
  1093
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
  1094
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
  1095
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
  1096
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
  1097
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
  1098
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
  1099
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
  1100
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
  1101
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
  1102
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
  1103
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
  1104
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
  1105
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
  1106
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
  1107
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
  1108
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
  1109
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
  1110
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
  1111
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
  1112
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
  1113
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
  1114
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
  1115
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
  1116
51a2fa6441b9 Prepare to delete search_constant_type_c -> Move the static variables from search_constant_type_c to get_datatype_info_c
Mario de Sousa <msousa@fe.up.pt>
parents: 676
diff changeset
  1117