2017-12-12 Jerry DeLisle <jvdelisle@gcc.gnu.org>
[official-gcc.git] / gcc / ada / tree_io.ads
blob75816be2d1189da87582a95980eab7bec0101ce8
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- T R E E _ I O --
6 -- --
7 -- S p e c --
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 -- As a special exception under Section 7 of GPL version 3, you are granted --
19 -- additional permissions described in the GCC Runtime Library Exception, --
20 -- version 3.1, as published by the Free Software Foundation. --
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 ------------------------------------------------------------------------------
32 -- This package contains the routines used to read and write the tree files
33 -- used by ASIS. Only the actual read and write routines are here. The open,
34 -- create and close routines are elsewhere (in Osint in the compiler, and in
35 -- the tree read driver for the tree read interface).
37 with Types; use Types;
38 with System; use System;
40 pragma Warnings (Off);
41 -- This package is used also by gnatcoll
42 with System.OS_Lib; use System.OS_Lib;
43 pragma Warnings (On);
45 package Tree_IO is
47 Tree_Format_Error : exception;
48 -- Raised if a format error is detected in the input file
50 ASIS_Version_Number : constant := 34;
51 -- ASIS Version. This is used to check for consistency between the compiler
52 -- used to generate trees and an ASIS application that is reading the
53 -- trees. It must be incremented whenever a change is made to the tree
54 -- format that would result in the compiler being incompatible with an
55 -- older version of ASIS.
57 -- 27 Changes in the tree structures for expression functions
58 -- 28 Changes in Snames
59 -- 29 Changes in Sem_Ch3 (tree copying in case of discriminant constraint
60 -- for concurrent types).
61 -- 30 Add Check_Float_Overflow boolean to tree file
62 -- 31 Remove read/write of Debug_Pragmas_Disabled/Debug_Pragmas_Enabled
63 -- 32 Change the way entities are changed through Next_Entity field in
64 -- the hierarchy of child units
65 -- 33 Add copying subtrees for rewriting infix calls of operator
66 -- functions for the corresponding original nodes.
67 -- 34 Add read/write of Address_Is_Private, Ignore_Rep_Clauses,
68 -- Ignore_Style_Check_Pragmas, Multiple_Unit_Index. Also this
69 -- is the version where rep clauses are removed by -gnatI.
71 procedure Tree_Read_Initialize (Desc : File_Descriptor);
72 -- Called to initialize reading of a tree file. This call must be made
73 -- before calls to Tree_Read_xx. No calls to Tree_Write_xx are permitted
74 -- after this call.
76 procedure Tree_Read_Data (Addr : Address; Length : Int);
77 -- Checks that the Length provided is the same as what has been provided
78 -- to the corresponding Tree_Write_Data from the current tree file,
79 -- Tree_Format_Error is raised if it is not the case. If Length is
80 -- correct and non zero, reads Length bytes of information into memory
81 -- starting at Addr from the current tree file.
83 procedure Tree_Read_Bool (B : out Boolean);
84 -- Reads a single boolean value. The boolean value must have been written
85 -- with a call to the Tree_Write_Bool procedure.
87 procedure Tree_Read_Char (C : out Character);
88 -- Reads a single character. The character must have been written with a
89 -- call to the Tree_Write_Char procedure.
91 procedure Tree_Read_Int (N : out Int);
92 -- Reads a single integer value. The integer must have been written with
93 -- a call to the Tree_Write_Int procedure.
95 procedure Tree_Read_Str (S : out String_Ptr);
96 -- Read string, allocate on heap, and return pointer to allocated string
97 -- which always has a lower bound of 1.
99 procedure Tree_Read_Terminate;
100 -- Called after reading all data, checks that the buffer pointers is at
101 -- the end of file, raising Tree_Format_Error if not.
103 procedure Tree_Write_Initialize (Desc : File_Descriptor);
104 -- Called to initialize writing of a tree file. This call must be made
105 -- before calls to Tree_Write_xx. No calls to Tree_Read_xx are permitted
106 -- after this call.
108 procedure Tree_Write_Data (Addr : Address; Length : Int);
109 -- Writes Length then, if Length is not null, Length bytes of data
110 -- starting at Addr to current tree file
112 procedure Tree_Write_Bool (B : Boolean);
113 -- Writes a single boolean value to the current tree file
115 procedure Tree_Write_Char (C : Character);
116 -- Writes a single character to the current tree file
118 procedure Tree_Write_Int (N : Int);
119 -- Writes a single integer value to the current tree file
121 procedure Tree_Write_Str (S : String_Ptr);
122 -- Write out string value referenced by S (low bound of S must be 1)
124 procedure Tree_Write_Terminate;
125 -- Terminates writing of the file (flushing the buffer), but does not
126 -- close the file (the caller is responsible for closing the file).
128 end Tree_IO;