OSDN Git Service

* Makefile.in (reload1.o-warn): Remove.
[pf3gnuchains/gcc-fork.git] / gcc / ada / s-stratt.ads
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                         GNAT RUN-TIME COMPONENTS                         --
4 --                                                                          --
5 --             S Y S T E M . S T R E A M _ A T T R I B U T E S              --
6 --                                                                          --
7 --                                 S p e c                                  --
8 --                                                                          --
9 --          Copyright (C) 1992-2006, 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 ------------------------------------------------------------------------------
33
34 --  This package contains the implementations of the stream attributes for
35 --  elementary types. These are the subprograms that are directly accessed
36 --  by occurrences of the stream attributes where the type is elementary.
37
38 --  We only provide the subprograms for the standard base types. For user
39 --  defined types, the subprogram for the corresponding root type is called
40 --  with an appropriate conversion.
41
42 with System;
43 with System.Unsigned_Types;
44 with Ada.Streams;
45
46 package System.Stream_Attributes is
47    pragma Preelaborate;
48
49    pragma Suppress (Accessibility_Check, Stream_Attributes);
50    --  No need to check accessibility on arguments of subprograms
51
52    package UST renames System.Unsigned_Types;
53
54    subtype RST is Ada.Streams.Root_Stream_Type'Class;
55
56    subtype SEC is Ada.Streams.Stream_Element_Count;
57
58    --  Enumeration types are usually transferred using the routine for the
59    --  corresponding integer. The exception is that special routines are
60    --  provided for Boolean and the character types, in case the protocol
61    --  in use provides specially for these types.
62
63    --  Access types use either a thin pointer (single address) or fat pointer
64    --  (double address) form. The following types are used to hold access
65    --  values using unchecked conversions.
66
67    type Thin_Pointer is record
68       P1 : System.Address;
69    end record;
70
71    type Fat_Pointer is record
72       P1 : System.Address;
73       P2 : System.Address;
74    end record;
75
76    ------------------------------------
77    -- Treatment of enumeration types --
78    ------------------------------------
79
80    --  In this interface, there are no specific routines for general input
81    --  or output of enumeration types. Generally, enumeration types whose
82    --  representation is unsigned (no negative representation values) are
83    --  treated as unsigned integers, and enumeration types that do have
84    --  negative representation values are treated as signed integers.
85
86    --  An exception is that there are specialized routines for Boolean,
87    --  Character, and Wide_Character types, but these specialized routines
88    --  are used only if the type in question has a standard representation.
89    --  For the case of a non-standard representation (one where the size of
90    --  the first subtype is specified, or where an enumeration representation
91    --  clause is given, these three types are treated like any other cases
92    --  of enumeration types, as described above.
93    --  for
94
95    ---------------------
96    -- Input Functions --
97    ---------------------
98
99    --  Functions for S'Input attribute. These functions are also used for
100    --  S'Read, with the obvious transformation, since the input operation
101    --  is the same for all elementary types (no bounds or discriminants
102    --  are involved).
103
104    function I_AD  (Stream : not null access RST) return Fat_Pointer;
105    function I_AS  (Stream : not null access RST) return Thin_Pointer;
106    function I_B   (Stream : not null access RST) return Boolean;
107    function I_C   (Stream : not null access RST) return Character;
108    function I_F   (Stream : not null access RST) return Float;
109    function I_I   (Stream : not null access RST) return Integer;
110    function I_LF  (Stream : not null access RST) return Long_Float;
111    function I_LI  (Stream : not null access RST) return Long_Integer;
112    function I_LLF (Stream : not null access RST) return Long_Long_Float;
113    function I_LLI (Stream : not null access RST) return Long_Long_Integer;
114    function I_LLU (Stream : not null access RST) return UST.Long_Long_Unsigned;
115    function I_LU  (Stream : not null access RST) return UST.Long_Unsigned;
116    function I_SF  (Stream : not null access RST) return Short_Float;
117    function I_SI  (Stream : not null access RST) return Short_Integer;
118    function I_SSI (Stream : not null access RST) return Short_Short_Integer;
119    function I_SSU (Stream : not null access RST)
120      return UST.Short_Short_Unsigned;
121    function I_SU  (Stream : not null access RST) return UST.Short_Unsigned;
122    function I_U   (Stream : not null access RST) return UST.Unsigned;
123    function I_WC  (Stream : not null access RST) return Wide_Character;
124
125    -----------------------
126    -- Output Procedures --
127    -----------------------
128
129    --  Procedures for S'Write attribute. These procedures are also used
130    --  for 'Output, since for elementary types there is no difference
131    --  between 'Write and 'Output because there are no discriminants
132    --  or bounds to be written.
133
134    procedure W_AD  (Stream : not null access RST; Item : Fat_Pointer);
135    procedure W_AS  (Stream : not null access RST; Item : Thin_Pointer);
136    procedure W_B   (Stream : not null access RST; Item : Boolean);
137    procedure W_C   (Stream : not null access RST; Item : Character);
138    procedure W_F   (Stream : not null access RST; Item : Float);
139    procedure W_I   (Stream : not null access RST; Item : Integer);
140    procedure W_LF  (Stream : not null access RST; Item : Long_Float);
141    procedure W_LI  (Stream : not null access RST; Item : Long_Integer);
142    procedure W_LLF (Stream : not null access RST; Item : Long_Long_Float);
143    procedure W_LLI (Stream : not null access RST; Item : Long_Long_Integer);
144    procedure W_LLU (Stream : not null access RST;
145                     Item   : UST.Long_Long_Unsigned);
146    procedure W_LU  (Stream : not null access RST; Item : UST.Long_Unsigned);
147    procedure W_SF  (Stream : not null access RST; Item : Short_Float);
148    procedure W_SI  (Stream : not null access RST; Item : Short_Integer);
149    procedure W_SSI (Stream : not null access RST;
150                     Item   : Short_Short_Integer);
151    procedure W_SSU (Stream : not null access RST;
152                     Item   : UST.Short_Short_Unsigned);
153    procedure W_SU  (Stream : not null access RST;
154                     Item   : UST.Short_Unsigned);
155    procedure W_U   (Stream : not null access RST; Item : UST.Unsigned);
156    procedure W_WC  (Stream : not null access RST; Item : Wide_Character);
157
158 private
159    pragma Inline (I_AD);
160    pragma Inline (I_AS);
161    pragma Inline (I_B);
162    pragma Inline (I_C);
163    pragma Inline (I_F);
164    pragma Inline (I_I);
165    pragma Inline (I_LF);
166    pragma Inline (I_LI);
167    pragma Inline (I_LLF);
168    pragma Inline (I_LLI);
169    pragma Inline (I_LLU);
170    pragma Inline (I_LU);
171    pragma Inline (I_SF);
172    pragma Inline (I_SI);
173    pragma Inline (I_SSI);
174    pragma Inline (I_SSU);
175    pragma Inline (I_SU);
176    pragma Inline (I_U);
177    pragma Inline (I_WC);
178
179    pragma Inline (W_AD);
180    pragma Inline (W_AS);
181    pragma Inline (W_B);
182    pragma Inline (W_C);
183    pragma Inline (W_F);
184    pragma Inline (W_I);
185    pragma Inline (W_LF);
186    pragma Inline (W_LI);
187    pragma Inline (W_LLF);
188    pragma Inline (W_LLI);
189    pragma Inline (W_LLU);
190    pragma Inline (W_LU);
191    pragma Inline (W_SF);
192    pragma Inline (W_SI);
193    pragma Inline (W_SSI);
194    pragma Inline (W_SSU);
195    pragma Inline (W_SU);
196    pragma Inline (W_U);
197    pragma Inline (W_WC);
198
199 end System.Stream_Attributes;