Remove old autovect-branch by moving to "dead" directory.
[official-gcc.git] / old-autovect-branch / gcc / ada / s-direio.ads
blob408af205b9bea5f38c411de8d811b64011967dd9
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT RUN-TIME COMPONENTS --
4 -- --
5 -- S Y S T E M . D I R E C T _ I O --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 1992-2005 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 2, 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. See the GNU General Public License --
17 -- for more details. You should have received a copy of the GNU General --
18 -- Public License distributed with GNAT; see file COPYING. If not, write --
19 -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
20 -- Boston, MA 02110-1301, USA. --
21 -- --
22 -- As a special exception, if other files instantiate generics from this --
23 -- unit, or you link this unit with other files to produce an executable, --
24 -- this unit does not by itself cause the resulting executable to be --
25 -- covered by the GNU General Public License. This exception does not --
26 -- however invalidate any other reasons why the executable file might be --
27 -- covered by the GNU Public License. --
28 -- --
29 -- GNAT was originally developed by the GNAT team at New York University. --
30 -- Extensive contributions were provided by Ada Core Technologies Inc. --
31 -- --
32 ------------------------------------------------------------------------------
34 -- This package contains the declaration of the control block used for
35 -- Direct_IO. This must be declared at the outer library level. It also
36 -- contains code that is shared between instances of Direct_IO.
38 with Interfaces.C_Streams;
39 with Ada.Streams;
40 with System.File_Control_Block;
41 with System.Storage_Elements;
43 package System.Direct_IO is
45 package FCB renames System.File_Control_Block;
47 type Operation is (Op_Read, Op_Write, Op_Other);
48 -- Type used to record last operation (to optimize sequential operations)
50 subtype Count is Interfaces.C_Streams.long;
51 -- The Count type in each instantiation is derived from this type
53 subtype Positive_Count is Count range 1 .. Count'Last;
55 type Direct_AFCB is new FCB.AFCB with record
56 Index : Count := 1;
57 -- Current Index value
59 Bytes : Interfaces.C_Streams.size_t;
60 -- Length of item in bytes (set from inside generic template)
62 Last_Op : Operation := Op_Other;
63 -- Last operation performed on file, used to avoid unnecessary
64 -- repositioning between successive read or write operations.
65 end record;
67 function AFCB_Allocate (Control_Block : Direct_AFCB) return FCB.AFCB_Ptr;
69 procedure AFCB_Close (File : access Direct_AFCB);
70 procedure AFCB_Free (File : access Direct_AFCB);
72 procedure Read
73 (File : in out Direct_AFCB;
74 Item : out Ada.Streams.Stream_Element_Array;
75 Last : out Ada.Streams.Stream_Element_Offset);
76 -- Required overriding of Read, not actually used for Direct_IO
78 procedure Write
79 (File : in out Direct_AFCB;
80 Item : in Ada.Streams.Stream_Element_Array);
81 -- Required overriding of Write, not actually used for Direct_IO
83 type File_Type is access all Direct_AFCB;
84 -- File_Type in individual instantiations is derived from this type
86 procedure Create
87 (File : in out File_Type;
88 Mode : in FCB.File_Mode := FCB.Inout_File;
89 Name : in String := "";
90 Form : in String := "");
92 function End_Of_File (File : in File_Type) return Boolean;
94 function Index (File : in File_Type) return Positive_Count;
96 procedure Open
97 (File : in out File_Type;
98 Mode : in FCB.File_Mode;
99 Name : in String;
100 Form : in String := "");
102 procedure Read
103 (File : in File_Type;
104 Item : System.Address;
105 Size : in Interfaces.C_Streams.size_t;
106 From : in Positive_Count);
108 procedure Read
109 (File : in File_Type;
110 Item : System.Address;
111 Size : in Interfaces.C_Streams.size_t);
113 procedure Reset (File : in out File_Type; Mode : in FCB.File_Mode);
115 procedure Reset (File : in out File_Type);
117 procedure Set_Index (File : in File_Type; To : in Positive_Count);
119 function Size (File : in File_Type) return Count;
121 procedure Write
122 (File : in File_Type;
123 Item : System.Address;
124 Size : in Interfaces.C_Streams.size_t;
125 Zeroes : System.Storage_Elements.Storage_Array);
126 -- Note: Zeroes is the buffer of zeroes used to fill out partial records
128 end System.Direct_IO;