PR c++/43856
[official-gcc/constexpr.git] / gcc / ada / a-sequio.ads
bloba728c5403546445446f88b6f0efa3e95f6c8dd41
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT RUN-TIME COMPONENTS --
4 -- --
5 -- A D A . S E Q U E N T I A L _ I O --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
10 -- --
11 -- This specification is derived from the Ada Reference Manual for use with --
12 -- GNAT. The copyright notice above, and the license provisions that follow --
13 -- apply solely to the contents of the part following the private keyword. --
14 -- --
15 -- GNAT is free software; you can redistribute it and/or modify it under --
16 -- terms of the GNU General Public License as published by the Free Soft- --
17 -- ware Foundation; either version 3, or (at your option) any later ver- --
18 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
19 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
20 -- or FITNESS FOR A PARTICULAR PURPOSE. --
21 -- --
22 -- As a special exception under Section 7 of GPL version 3, you are granted --
23 -- additional permissions described in the GCC Runtime Library Exception, --
24 -- version 3.1, as published by the Free Software Foundation. --
25 -- --
26 -- You should have received a copy of the GNU General Public License and --
27 -- a copy of the GCC Runtime Library Exception along with this program; --
28 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
29 -- <http://www.gnu.org/licenses/>. --
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 with Ada.IO_Exceptions;
38 with System.Sequential_IO;
40 generic
41 type Element_Type (<>) is private;
43 package Ada.Sequential_IO is
45 pragma Compile_Time_Warning
46 (Element_Type'Has_Access_Values,
47 "Element_Type for Sequential_IO instance has access values");
49 pragma Compile_Time_Warning
50 (Element_Type'Has_Tagged_Values,
51 "Element_Type for Sequential_IO instance has tagged values");
53 type File_Type is limited private;
55 type File_Mode is (In_File, Out_File, Append_File);
57 -- The following representation clause allows the use of unchecked
58 -- conversion for rapid translation between the File_Mode type
59 -- used in this package and System.File_IO.
61 for File_Mode use
62 (In_File => 0, -- System.File_IO.File_Mode'Pos (In_File)
63 Out_File => 2, -- System.File_IO.File_Mode'Pos (Out_File)
64 Append_File => 3); -- System.File_IO.File_Mode'Pos (Append_File)
66 ---------------------
67 -- File management --
68 ---------------------
70 procedure Create
71 (File : in out File_Type;
72 Mode : File_Mode := Out_File;
73 Name : String := "";
74 Form : String := "");
76 procedure Open
77 (File : in out File_Type;
78 Mode : File_Mode;
79 Name : String;
80 Form : String := "");
82 procedure Close (File : in out File_Type);
83 procedure Delete (File : in out File_Type);
84 procedure Reset (File : in out File_Type; Mode : File_Mode);
85 procedure Reset (File : in out File_Type);
87 function Mode (File : File_Type) return File_Mode;
88 function Name (File : File_Type) return String;
89 function Form (File : File_Type) return String;
91 function Is_Open (File : File_Type) return Boolean;
93 ---------------------------------
94 -- Input and output operations --
95 ---------------------------------
97 procedure Read (File : File_Type; Item : out Element_Type);
98 procedure Write (File : File_Type; Item : Element_Type);
100 function End_Of_File (File : File_Type) return Boolean;
102 ----------------
103 -- Exceptions --
104 ----------------
106 Status_Error : exception renames IO_Exceptions.Status_Error;
107 Mode_Error : exception renames IO_Exceptions.Mode_Error;
108 Name_Error : exception renames IO_Exceptions.Name_Error;
109 Use_Error : exception renames IO_Exceptions.Use_Error;
110 Device_Error : exception renames IO_Exceptions.Device_Error;
111 End_Error : exception renames IO_Exceptions.End_Error;
112 Data_Error : exception renames IO_Exceptions.Data_Error;
114 private
116 -- The following procedures have a File_Type formal of mode IN OUT because
117 -- they may close the original file. The Close operation may raise an
118 -- exception, but in that case we want any assignment to the formal to
119 -- be effective anyway, so it must be passed by reference (or the caller
120 -- will be left with a dangling pointer).
122 pragma Export_Procedure
123 (Internal => Close,
124 External => "",
125 Mechanism => Reference);
126 pragma Export_Procedure
127 (Internal => Delete,
128 External => "",
129 Mechanism => Reference);
130 pragma Export_Procedure
131 (Internal => Reset,
132 External => "",
133 Parameter_Types => (File_Type),
134 Mechanism => Reference);
135 pragma Export_Procedure
136 (Internal => Reset,
137 External => "",
138 Parameter_Types => (File_Type, File_Mode),
139 Mechanism => (File => Reference));
141 type File_Type is new System.Sequential_IO.File_Type;
143 -- All subprograms are inlined
145 pragma Inline (Close);
146 pragma Inline (Create);
147 pragma Inline (Delete);
148 pragma Inline (End_Of_File);
149 pragma Inline (Form);
150 pragma Inline (Is_Open);
151 pragma Inline (Mode);
152 pragma Inline (Name);
153 pragma Inline (Open);
154 pragma Inline (Read);
155 pragma Inline (Reset);
156 pragma Inline (Write);
158 end Ada.Sequential_IO;