* options.c (gfc_handle_module_path_options): Fix buffer overrun.
[official-gcc.git] / gcc / ada / a-direio.ads
blob6137c336610d2c1f7ab49cbf77e0b3d951101eb9
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 -- Copyright (C) 1992-1999 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 2, 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. See the GNU General Public License --
21 -- for more details. You should have received a copy of the GNU General --
22 -- Public License distributed with GNAT; see file COPYING. If not, write --
23 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
24 -- MA 02111-1307, USA. --
25 -- --
26 -- As a special exception, if other files instantiate generics from this --
27 -- unit, or you link this unit with other files to produce an executable, --
28 -- this unit does not by itself cause the resulting executable to be --
29 -- covered by the GNU General Public License. This exception does not --
30 -- however invalidate any other reasons why the executable file might be --
31 -- covered by the GNU Public License. --
32 -- --
33 -- GNAT was originally developed by the GNAT team at New York University. --
34 -- Extensive contributions were provided by Ada Core Technologies Inc. --
35 -- --
36 ------------------------------------------------------------------------------
39 with Ada.IO_Exceptions;
40 with System.Direct_IO;
41 with Interfaces.C_Streams;
43 generic
44 type Element_Type is private;
46 package Ada.Direct_IO is
48 type File_Type is limited private;
50 type File_Mode is (In_File, Inout_File, Out_File);
52 -- The following representation clause allows the use of unchecked
53 -- conversion for rapid translation between the File_Mode type
54 -- used in this package and System.File_IO.
56 for File_Mode use
57 (In_File => 0, -- System.File_IO.File_Mode'Pos (In_File)
58 Inout_File => 1, -- System.File_IO.File_Mode'Pos (Inout_File);
59 Out_File => 2); -- System.File_IO.File_Mode'Pos (Out_File)
61 type Count is range 0 .. System.Direct_IO.Count'Last;
63 subtype Positive_Count is Count range 1 .. Count'Last;
65 ---------------------
66 -- File Management --
67 ---------------------
69 procedure Create
70 (File : in out File_Type;
71 Mode : in File_Mode := Inout_File;
72 Name : in String := "";
73 Form : in String := "");
75 procedure Open
76 (File : in out File_Type;
77 Mode : in File_Mode;
78 Name : in String;
79 Form : in String := "");
81 procedure Close (File : in out File_Type);
82 procedure Delete (File : in out File_Type);
83 procedure Reset (File : in out File_Type; Mode : in File_Mode);
84 procedure Reset (File : in out File_Type);
86 function Mode (File : in File_Type) return File_Mode;
87 function Name (File : in File_Type) return String;
88 function Form (File : in File_Type) return String;
90 function Is_Open (File : in File_Type) return Boolean;
92 ---------------------------------
93 -- Input and Output Operations --
94 ---------------------------------
96 procedure Read
97 (File : in File_Type;
98 Item : out Element_Type;
99 From : in Positive_Count);
101 procedure Read
102 (File : in File_Type;
103 Item : out Element_Type);
105 procedure Write
106 (File : in File_Type;
107 Item : in Element_Type;
108 To : in Positive_Count);
110 procedure Write
111 (File : in File_Type;
112 Item : in Element_Type);
114 procedure Set_Index (File : in File_Type; To : in Positive_Count);
116 function Index (File : in File_Type) return Positive_Count;
117 function Size (File : in File_Type) return Count;
119 function End_Of_File (File : in File_Type) return Boolean;
121 ----------------
122 -- Exceptions --
123 ----------------
125 Status_Error : exception renames IO_Exceptions.Status_Error;
126 Mode_Error : exception renames IO_Exceptions.Mode_Error;
127 Name_Error : exception renames IO_Exceptions.Name_Error;
128 Use_Error : exception renames IO_Exceptions.Use_Error;
129 Device_Error : exception renames IO_Exceptions.Device_Error;
130 End_Error : exception renames IO_Exceptions.End_Error;
131 Data_Error : exception renames IO_Exceptions.Data_Error;
133 private
134 type File_Type is new System.Direct_IO.File_Type;
136 Bytes : constant Interfaces.C_Streams.size_t :=
137 Element_Type'Max_Size_In_Storage_Elements;
138 -- Size of an element in storage units
140 pragma Inline (Close);
141 pragma Inline (Create);
142 pragma Inline (Delete);
143 pragma Inline (End_Of_File);
144 pragma Inline (Form);
145 pragma Inline (Index);
146 pragma Inline (Is_Open);
147 pragma Inline (Mode);
148 pragma Inline (Name);
149 pragma Inline (Open);
150 pragma Inline (Read);
151 pragma Inline (Reset);
152 pragma Inline (Set_Index);
153 pragma Inline (Size);
154 pragma Inline (Write);
156 end Ada.Direct_IO;