Daily bump.
[official-gcc.git] / gcc / ada / tree_io.ads
blob45719dd9089e6faad9e7a626d910008b555ffd29
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- T R E E _ I O --
6 -- --
7 -- S p e c --
8 -- --
9 -- $Revision: 1.1.16.1 $
10 -- --
11 -- Copyright (C) 1992-1999 Free Software Foundation, Inc. --
12 -- --
13 -- GNAT is free software; you can redistribute it and/or modify it under --
14 -- terms of the GNU General Public License as published by the Free Soft- --
15 -- ware Foundation; either version 2, or (at your option) any later ver- --
16 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
17 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
18 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
19 -- for more details. You should have received a copy of the GNU General --
20 -- Public License distributed with GNAT; see file COPYING. If not, write --
21 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
22 -- MA 02111-1307, USA. --
23 -- --
24 -- As a special exception, if other files instantiate generics from this --
25 -- unit, or you link this unit with other files to produce an executable, --
26 -- this unit does not by itself cause the resulting executable to be --
27 -- covered by the GNU General Public License. This exception does not --
28 -- however invalidate any other reasons why the executable file might be --
29 -- covered by the GNU Public License. --
30 -- --
31 -- GNAT was originally developed by the GNAT team at New York University. --
32 -- Extensive contributions were provided by Ada Core Technologies Inc. --
33 -- --
34 ------------------------------------------------------------------------------
36 -- This package contains the routines used to read and write the tree files
37 -- used by ASIS. Only the actual read and write routines are here. The open,
38 -- create and close routines are elsewhere (in Osint in the compiler, and in
39 -- the tree read driver for the tree read interface).
41 with GNAT.OS_Lib; use GNAT.OS_Lib;
42 with System; use System;
43 with Types; use Types;
45 package Tree_IO is
47 Tree_Format_Error : exception;
48 -- Raised if a format error is detected in the input file
50 procedure Tree_Read_Initialize (Desc : File_Descriptor);
51 -- Called to initialize reading of a tree file. This call must be made
52 -- before calls to Tree_Read_xx. No calls to Tree_Write_xx are permitted
53 -- after this call.
55 procedure Tree_Read_Data (Addr : Address; Length : Int);
56 -- Checks that the Length provided is the same as what has been provided
57 -- to the corresponding Tree_Write_Data from the current tree file,
58 -- Tree_Format_Error is raised if it is not the case. If Length is
59 -- correct and non zero, reads Length bytes of information into memory
60 -- starting at Addr from the current tree file.
62 procedure Tree_Read_Bool (B : out Boolean);
63 -- Reads a single boolean value. The boolean value must have been written
64 -- with a call to the Tree_Write_Bool procedure.
66 procedure Tree_Read_Char (C : out Character);
67 -- Reads a single character. The character must have been written with a
68 -- call to the Tree_Write_Char procedure.
70 procedure Tree_Read_Int (N : out Int);
71 -- Reads a single integer value. The integer must have been written with
72 -- a call to the Tree_Write_Int procedure.
74 procedure Tree_Read_Str (S : out String_Ptr);
75 -- Read string, allocate on heap, and return pointer to allocated string
76 -- which always has a lower bound of 1.
78 procedure Tree_Read_Terminate;
79 -- Called after reading all data, checks that the buffer pointers is at
80 -- the end of file, raising Tree_Format_Error if not.
82 procedure Tree_Write_Initialize (Desc : File_Descriptor);
83 -- Called to initialize writing of a tree file. This call must be made
84 -- before calls to Tree_Write_xx. No calls to Tree_Read_xx are permitted
85 -- after this call.
87 procedure Tree_Write_Data (Addr : Address; Length : Int);
88 -- Writes Length then, if Length is not null, Length bytes of data
89 -- starting at Addr to current tree file
91 procedure Tree_Write_Bool (B : Boolean);
92 -- Writes a single boolean value to the current tree file
94 procedure Tree_Write_Char (C : Character);
95 -- Writes a single character to the current tree file
97 procedure Tree_Write_Int (N : Int);
98 -- Writes a single integer value to the current tree file
100 procedure Tree_Write_Str (S : String_Ptr);
101 -- Write out string value referenced by S. Low bound must be 1.
103 procedure Tree_Write_Terminate;
104 -- Terminates writing of the file (flushing the buffer), but does not
105 -- close the file (the caller is responsible for closing the file).
107 end Tree_IO;