(extendsfdf2): Add pattern accidentally deleted when cirrus instructions were
[official-gcc.git] / gcc / ada / a-direio.ads
blobfd89d7121d3d78c17cba0e37c174a84b35303d78
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT RUN-TIME COMPONENTS --
4 -- --
5 -- A D A . D I R E C T _ I O --
6 -- --
7 -- S p e c --
8 -- --
9 -- --
10 -- Copyright (C) 1992-1999 Free Software Foundation, Inc. --
11 -- --
12 -- This specification is derived from the Ada Reference Manual for use with --
13 -- GNAT. The copyright notice above, and the license provisions that follow --
14 -- apply solely to the contents of the part following the private keyword. --
15 -- --
16 -- GNAT is free software; you can redistribute it and/or modify it under --
17 -- terms of the GNU General Public License as published by the Free Soft- --
18 -- ware Foundation; either version 2, or (at your option) any later ver- --
19 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
20 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
21 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
22 -- for more details. You should have received a copy of the GNU General --
23 -- Public License distributed with GNAT; see file COPYING. If not, write --
24 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
25 -- MA 02111-1307, USA. --
26 -- --
27 -- As a special exception, if other files instantiate generics from this --
28 -- unit, or you link this unit with other files to produce an executable, --
29 -- this unit does not by itself cause the resulting executable to be --
30 -- covered by the GNU General Public License. This exception does not --
31 -- however invalidate any other reasons why the executable file might be --
32 -- covered by the GNU Public License. --
33 -- --
34 -- GNAT was originally developed by the GNAT team at New York University. --
35 -- Extensive contributions were provided by Ada Core Technologies Inc. --
36 -- --
37 ------------------------------------------------------------------------------
40 with Ada.IO_Exceptions;
41 with System.Direct_IO;
42 with Interfaces.C_Streams;
44 generic
45 type Element_Type is private;
47 package Ada.Direct_IO is
49 type File_Type is limited private;
51 type File_Mode is (In_File, Inout_File, Out_File);
53 -- The following representation clause allows the use of unchecked
54 -- conversion for rapid translation between the File_Mode type
55 -- used in this package and System.File_IO.
57 for File_Mode use
58 (In_File => 0, -- System.File_IO.File_Mode'Pos (In_File)
59 Inout_File => 1, -- System.File_IO.File_Mode'Pos (Inout_File);
60 Out_File => 2); -- System.File_IO.File_Mode'Pos (Out_File)
62 type Count is range 0 .. System.Direct_IO.Count'Last;
64 subtype Positive_Count is Count range 1 .. Count'Last;
66 ---------------------
67 -- File Management --
68 ---------------------
70 procedure Create
71 (File : in out File_Type;
72 Mode : in File_Mode := Inout_File;
73 Name : in String := "";
74 Form : in String := "");
76 procedure Open
77 (File : in out File_Type;
78 Mode : in File_Mode;
79 Name : in String;
80 Form : in 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 : in File_Mode);
85 procedure Reset (File : in out File_Type);
87 function Mode (File : in File_Type) return File_Mode;
88 function Name (File : in File_Type) return String;
89 function Form (File : in File_Type) return String;
91 function Is_Open (File : in File_Type) return Boolean;
93 ---------------------------------
94 -- Input and Output Operations --
95 ---------------------------------
97 procedure Read
98 (File : in File_Type;
99 Item : out Element_Type;
100 From : in Positive_Count);
102 procedure Read
103 (File : in File_Type;
104 Item : out Element_Type);
106 procedure Write
107 (File : in File_Type;
108 Item : in Element_Type;
109 To : in Positive_Count);
111 procedure Write
112 (File : in File_Type;
113 Item : in Element_Type);
115 procedure Set_Index (File : in File_Type; To : in Positive_Count);
117 function Index (File : in File_Type) return Positive_Count;
118 function Size (File : in File_Type) return Count;
120 function End_Of_File (File : in File_Type) return Boolean;
122 ----------------
123 -- Exceptions --
124 ----------------
126 Status_Error : exception renames IO_Exceptions.Status_Error;
127 Mode_Error : exception renames IO_Exceptions.Mode_Error;
128 Name_Error : exception renames IO_Exceptions.Name_Error;
129 Use_Error : exception renames IO_Exceptions.Use_Error;
130 Device_Error : exception renames IO_Exceptions.Device_Error;
131 End_Error : exception renames IO_Exceptions.End_Error;
132 Data_Error : exception renames IO_Exceptions.Data_Error;
134 private
135 type File_Type is new System.Direct_IO.File_Type;
137 Bytes : constant Interfaces.C_Streams.size_t :=
138 Element_Type'Max_Size_In_Storage_Elements;
139 -- Size of an element in storage units
141 pragma Inline (Close);
142 pragma Inline (Create);
143 pragma Inline (Delete);
144 pragma Inline (End_Of_File);
145 pragma Inline (Form);
146 pragma Inline (Index);
147 pragma Inline (Is_Open);
148 pragma Inline (Mode);
149 pragma Inline (Name);
150 pragma Inline (Open);
151 pragma Inline (Read);
152 pragma Inline (Reset);
153 pragma Inline (Set_Index);
154 pragma Inline (Size);
155 pragma Inline (Write);
157 end Ada.Direct_IO;