OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [ada/] [s-direio.ads] - Blame information for rev 706

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 706 jeremybenn
------------------------------------------------------------------------------
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-2009, 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 3,  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.                                     --
17
--                                                                          --
18
-- As a special exception under Section 7 of GPL version 3, you are granted --
19
-- additional permissions described in the GCC Runtime Library Exception,   --
20
-- version 3.1, as published by the Free Software Foundation.               --
21
--                                                                          --
22
-- You should have received a copy of the GNU General Public License and    --
23
-- a copy of the GCC Runtime Library Exception along with this program;     --
24
-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
25
-- <http://www.gnu.org/licenses/>.                                          --
26
--                                                                          --
27
-- GNAT was originally developed  by the GNAT team at  New York University. --
28
-- Extensive contributions were provided by Ada Core Technologies Inc.      --
29
--                                                                          --
30
------------------------------------------------------------------------------
31
 
32
--  This package contains the declaration of the control block used for
33
--  Direct_IO. This must be declared at the outer library level. It also
34
--  contains code that is shared between instances of Direct_IO.
35
 
36
with Interfaces.C_Streams;
37
with Ada.Streams;
38
with System.File_Control_Block;
39
with System.Storage_Elements;
40
 
41
package System.Direct_IO is
42
 
43
   package FCB renames System.File_Control_Block;
44
 
45
   type Operation is (Op_Read, Op_Write, Op_Other);
46
   --  Type used to record last operation (to optimize sequential operations)
47
 
48
   subtype Count is Interfaces.C_Streams.long;
49
   --  The Count type in each instantiation is derived from this type
50
 
51
   subtype Positive_Count is Count range 1 .. Count'Last;
52
 
53
   type Direct_AFCB is new FCB.AFCB with record
54
      Index : Count := 1;
55
      --  Current Index value
56
 
57
      Bytes : Interfaces.C_Streams.size_t;
58
      --  Length of item in bytes (set from inside generic template)
59
 
60
      Last_Op : Operation := Op_Other;
61
      --  Last operation performed on file, used to avoid unnecessary
62
      --  repositioning between successive read or write operations.
63
   end record;
64
 
65
   function AFCB_Allocate (Control_Block : Direct_AFCB) return FCB.AFCB_Ptr;
66
 
67
   procedure AFCB_Close (File : not null access Direct_AFCB);
68
   procedure AFCB_Free  (File : not null access Direct_AFCB);
69
 
70
   procedure Read
71
     (File : in out Direct_AFCB;
72
      Item : out Ada.Streams.Stream_Element_Array;
73
      Last : out Ada.Streams.Stream_Element_Offset);
74
   --  Required overriding of Read, not actually used for Direct_IO
75
 
76
   procedure Write
77
     (File : in out Direct_AFCB;
78
      Item : Ada.Streams.Stream_Element_Array);
79
   --  Required overriding of Write, not actually used for Direct_IO
80
 
81
   type File_Type is access all Direct_AFCB;
82
   --  File_Type in individual instantiations is derived from this type
83
 
84
   procedure Create
85
     (File : in out File_Type;
86
      Mode : FCB.File_Mode := FCB.Inout_File;
87
      Name : String := "";
88
      Form : String := "");
89
 
90
   function End_Of_File (File : File_Type) return Boolean;
91
 
92
   function Index (File : File_Type) return Positive_Count;
93
 
94
   procedure Open
95
     (File : in out File_Type;
96
      Mode : FCB.File_Mode;
97
      Name : String;
98
      Form : String := "");
99
 
100
   procedure Read
101
     (File : File_Type;
102
      Item : System.Address;
103
      Size : Interfaces.C_Streams.size_t;
104
      From : Positive_Count);
105
 
106
   procedure Read
107
     (File : File_Type;
108
      Item : System.Address;
109
      Size : Interfaces.C_Streams.size_t);
110
 
111
   procedure Reset (File : in out File_Type; Mode : FCB.File_Mode);
112
   procedure Reset (File : in out File_Type);
113
 
114
   procedure Set_Index (File : File_Type; To : Positive_Count);
115
 
116
   function Size (File : File_Type) return Count;
117
 
118
   procedure Write
119
     (File   : File_Type;
120
      Item   : System.Address;
121
      Size   : Interfaces.C_Streams.size_t;
122
      Zeroes : System.Storage_Elements.Storage_Array);
123
   --  Note: Zeroes is the buffer of zeroes used to fill out partial records
124
 
125
   --  The following procedures have a File_Type formal of mode IN OUT because
126
   --  they may close the original file. The Close operation may raise an
127
   --  exception, but in that case we want any assignment to the formal to
128
   --  be effective anyway, so it must be passed by reference (or the caller
129
   --  will be left with a dangling pointer).
130
 
131
   pragma Export_Procedure
132
     (Internal        => Reset,
133
      External        => "",
134
      Parameter_Types => (File_Type),
135
      Mechanism       => Reference);
136
   pragma Export_Procedure
137
     (Internal        => Reset,
138
      External        => "",
139
      Parameter_Types => (File_Type, FCB.File_Mode),
140
      Mechanism       => (File => Reference));
141
 
142
end System.Direct_IO;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.