File : stand.adb


   1 ------------------------------------------------------------------------------
   2 --                                                                          --
   3 --                         GNAT COMPILER COMPONENTS                         --
   4 --                                                                          --
   5 --                                S T A N D                                 --
   6 --                                                                          --
   7 --                                 B o d y                                  --
   8 --                                                                          --
   9 --          Copyright (C) 1992-2014, Free Software Foundation, Inc.        --
  10 --                                                                          --
  11 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
  12 -- terms of the  GNU General Public License as published  by the Free Soft- --
  13 -- ware  Foundation;  either version 3,  or (at your option) any later ver- --
  14 -- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
  15 -- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
  16 -- or FITNESS FOR A PARTICULAR PURPOSE.                                     --
  17 --                                                                          --
  18 --                                                                          --
  19 --                                                                          --
  20 --                                                                          --
  21 --                                                                          --
  22 -- You should have received a copy of the GNU General Public License and    --
  23 -- a copy of the GCC Runtime Library Exception along with this program;     --
  24 -- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
  25 -- <http://www.gnu.org/licenses/>.                                          --
  26 --                                                                          --
  27 -- GNAT was originally developed  by the GNAT team at  New York University. --
  28 -- Extensive contributions were provided by Ada Core Technologies Inc.      --
  29 --                                                                          --
  30 ------------------------------------------------------------------------------
  31 
  32 with Elists;  use Elists;
  33 with System;  use System;
  34 with Tree_IO; use Tree_IO;
  35 
  36 package body Stand is
  37 
  38    ---------------
  39    -- Tree_Read --
  40    ---------------
  41 
  42    procedure Tree_Read is
  43    begin
  44       Tree_Read_Data (Standard_Entity'Address,
  45                        Standard_Entity_Array_Type'Size / Storage_Unit);
  46 
  47       Tree_Read_Int (Int (Standard_Package_Node));
  48       Tree_Read_Int (Int (Last_Standard_Node_Id));
  49       Tree_Read_Int (Int (Last_Standard_List_Id));
  50 
  51       Tree_Read_Int (Int (Boolean_Literals (False)));
  52       Tree_Read_Int (Int (Boolean_Literals (True)));
  53 
  54       Tree_Read_Int (Int (Standard_Void_Type));
  55       Tree_Read_Int (Int (Standard_Exception_Type));
  56       Tree_Read_Int (Int (Standard_A_String));
  57       Tree_Read_Int (Int (Standard_A_Char));
  58       Tree_Read_Int (Int (Standard_Debug_Renaming_Type));
  59 
  60       --  Deal with Predefined_Float_Types, which is an Elist. We wrote the
  61       --  entities out in sequence, terminated by an Empty entry.
  62 
  63       declare
  64          Elmt : Entity_Id;
  65       begin
  66          Predefined_Float_Types := New_Elmt_List;
  67          loop
  68             Tree_Read_Int (Int (Elmt));
  69             exit when Elmt = Empty;
  70             Append_Elmt (Elmt, Predefined_Float_Types);
  71          end loop;
  72       end;
  73 
  74       --  Remainder of special entities
  75 
  76       Tree_Read_Int (Int (Any_Id));
  77       Tree_Read_Int (Int (Any_Type));
  78       Tree_Read_Int (Int (Any_Access));
  79       Tree_Read_Int (Int (Any_Array));
  80       Tree_Read_Int (Int (Any_Boolean));
  81       Tree_Read_Int (Int (Any_Character));
  82       Tree_Read_Int (Int (Any_Composite));
  83       Tree_Read_Int (Int (Any_Discrete));
  84       Tree_Read_Int (Int (Any_Fixed));
  85       Tree_Read_Int (Int (Any_Integer));
  86       Tree_Read_Int (Int (Any_Modular));
  87       Tree_Read_Int (Int (Any_Numeric));
  88       Tree_Read_Int (Int (Any_Real));
  89       Tree_Read_Int (Int (Any_Scalar));
  90       Tree_Read_Int (Int (Any_String));
  91       Tree_Read_Int (Int (Raise_Type));
  92       Tree_Read_Int (Int (Universal_Integer));
  93       Tree_Read_Int (Int (Universal_Real));
  94       Tree_Read_Int (Int (Universal_Fixed));
  95       Tree_Read_Int (Int (Standard_Integer_8));
  96       Tree_Read_Int (Int (Standard_Integer_16));
  97       Tree_Read_Int (Int (Standard_Integer_32));
  98       Tree_Read_Int (Int (Standard_Integer_64));
  99       Tree_Read_Int (Int (Standard_Short_Short_Unsigned));
 100       Tree_Read_Int (Int (Standard_Short_Unsigned));
 101       Tree_Read_Int (Int (Standard_Unsigned));
 102       Tree_Read_Int (Int (Standard_Long_Unsigned));
 103       Tree_Read_Int (Int (Standard_Long_Long_Unsigned));
 104       Tree_Read_Int (Int (Standard_Unsigned_64));
 105       Tree_Read_Int (Int (Abort_Signal));
 106       Tree_Read_Int (Int (Standard_Op_Rotate_Left));
 107       Tree_Read_Int (Int (Standard_Op_Rotate_Right));
 108       Tree_Read_Int (Int (Standard_Op_Shift_Left));
 109       Tree_Read_Int (Int (Standard_Op_Shift_Right));
 110       Tree_Read_Int (Int (Standard_Op_Shift_Right_Arithmetic));
 111    end Tree_Read;
 112 
 113    ----------------
 114    -- Tree_Write --
 115    ----------------
 116 
 117    procedure Tree_Write is
 118    begin
 119       Tree_Write_Data (Standard_Entity'Address,
 120                        Standard_Entity_Array_Type'Size / Storage_Unit);
 121 
 122       Tree_Write_Int (Int (Standard_Package_Node));
 123       Tree_Write_Int (Int (Last_Standard_Node_Id));
 124       Tree_Write_Int (Int (Last_Standard_List_Id));
 125 
 126       Tree_Write_Int (Int (Boolean_Literals (False)));
 127       Tree_Write_Int (Int (Boolean_Literals (True)));
 128 
 129       Tree_Write_Int (Int (Standard_Void_Type));
 130       Tree_Write_Int (Int (Standard_Exception_Type));
 131       Tree_Write_Int (Int (Standard_A_String));
 132       Tree_Write_Int (Int (Standard_A_Char));
 133       Tree_Write_Int (Int (Standard_Debug_Renaming_Type));
 134 
 135       --  Deal with Predefined_Float_Types, which is an Elist. Write the
 136       --  entities out in sequence, terminated by an Empty entry.
 137 
 138       declare
 139          Elmt : Elmt_Id;
 140 
 141       begin
 142          Elmt := First_Elmt (Predefined_Float_Types);
 143          while Present (Elmt) loop
 144             Tree_Write_Int (Int (Node (Elmt)));
 145             Next_Elmt (Elmt);
 146          end loop;
 147 
 148          Tree_Write_Int (Int (Empty));
 149       end;
 150 
 151       --  Remainder of special entries
 152 
 153       Tree_Write_Int (Int (Any_Id));
 154       Tree_Write_Int (Int (Any_Type));
 155       Tree_Write_Int (Int (Any_Access));
 156       Tree_Write_Int (Int (Any_Array));
 157       Tree_Write_Int (Int (Any_Boolean));
 158       Tree_Write_Int (Int (Any_Character));
 159       Tree_Write_Int (Int (Any_Composite));
 160       Tree_Write_Int (Int (Any_Discrete));
 161       Tree_Write_Int (Int (Any_Fixed));
 162       Tree_Write_Int (Int (Any_Integer));
 163       Tree_Write_Int (Int (Any_Modular));
 164       Tree_Write_Int (Int (Any_Numeric));
 165       Tree_Write_Int (Int (Any_Real));
 166       Tree_Write_Int (Int (Any_Scalar));
 167       Tree_Write_Int (Int (Any_String));
 168       Tree_Write_Int (Int (Raise_Type));
 169       Tree_Write_Int (Int (Universal_Integer));
 170       Tree_Write_Int (Int (Universal_Real));
 171       Tree_Write_Int (Int (Universal_Fixed));
 172       Tree_Write_Int (Int (Standard_Integer_8));
 173       Tree_Write_Int (Int (Standard_Integer_16));
 174       Tree_Write_Int (Int (Standard_Integer_32));
 175       Tree_Write_Int (Int (Standard_Integer_64));
 176       Tree_Write_Int (Int (Standard_Short_Short_Unsigned));
 177       Tree_Write_Int (Int (Standard_Short_Unsigned));
 178       Tree_Write_Int (Int (Standard_Unsigned));
 179       Tree_Write_Int (Int (Standard_Long_Unsigned));
 180       Tree_Write_Int (Int (Standard_Long_Long_Unsigned));
 181       Tree_Write_Int (Int (Standard_Unsigned_64));
 182       Tree_Write_Int (Int (Abort_Signal));
 183       Tree_Write_Int (Int (Standard_Op_Rotate_Left));
 184       Tree_Write_Int (Int (Standard_Op_Rotate_Right));
 185       Tree_Write_Int (Int (Standard_Op_Shift_Left));
 186       Tree_Write_Int (Int (Standard_Op_Shift_Right));
 187       Tree_Write_Int (Int (Standard_Op_Shift_Right_Arithmetic));
 188    end Tree_Write;
 189 
 190 end Stand;