annotate gcc/ada/libgnat/s-stratt.ads @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children 1830386684a0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 ------------------------------------------------------------------------------
kono
parents:
diff changeset
2 -- --
kono
parents:
diff changeset
3 -- GNAT RUN-TIME COMPONENTS --
kono
parents:
diff changeset
4 -- --
kono
parents:
diff changeset
5 -- S Y S T E M . S T R E A M _ A T T R I B U T E S --
kono
parents:
diff changeset
6 -- --
kono
parents:
diff changeset
7 -- S p e c --
kono
parents:
diff changeset
8 -- --
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
9 -- Copyright (C) 1992-2018, Free Software Foundation, Inc. --
111
kono
parents:
diff changeset
10 -- --
kono
parents:
diff changeset
11 -- GNAT is free software; you can redistribute it and/or modify it under --
kono
parents:
diff changeset
12 -- terms of the GNU General Public License as published by the Free Soft- --
kono
parents:
diff changeset
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
kono
parents:
diff changeset
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
kono
parents:
diff changeset
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
kono
parents:
diff changeset
16 -- or FITNESS FOR A PARTICULAR PURPOSE. --
kono
parents:
diff changeset
17 -- --
kono
parents:
diff changeset
18 -- As a special exception under Section 7 of GPL version 3, you are granted --
kono
parents:
diff changeset
19 -- additional permissions described in the GCC Runtime Library Exception, --
kono
parents:
diff changeset
20 -- version 3.1, as published by the Free Software Foundation. --
kono
parents:
diff changeset
21 -- --
kono
parents:
diff changeset
22 -- You should have received a copy of the GNU General Public License and --
kono
parents:
diff changeset
23 -- a copy of the GCC Runtime Library Exception along with this program; --
kono
parents:
diff changeset
24 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
kono
parents:
diff changeset
25 -- <http://www.gnu.org/licenses/>. --
kono
parents:
diff changeset
26 -- --
kono
parents:
diff changeset
27 -- GNAT was originally developed by the GNAT team at New York University. --
kono
parents:
diff changeset
28 -- Extensive contributions were provided by Ada Core Technologies Inc. --
kono
parents:
diff changeset
29 -- --
kono
parents:
diff changeset
30 ------------------------------------------------------------------------------
kono
parents:
diff changeset
31
kono
parents:
diff changeset
32 -- This package contains the implementations of the stream attributes for
kono
parents:
diff changeset
33 -- elementary types. These are the subprograms that are directly accessed
kono
parents:
diff changeset
34 -- by occurrences of the stream attributes where the type is elementary.
kono
parents:
diff changeset
35
kono
parents:
diff changeset
36 -- We only provide the subprograms for the standard base types. For user
kono
parents:
diff changeset
37 -- defined types, the subprogram for the corresponding root type is called
kono
parents:
diff changeset
38 -- with an appropriate conversion.
kono
parents:
diff changeset
39
kono
parents:
diff changeset
40 with System;
kono
parents:
diff changeset
41 with System.Unsigned_Types;
kono
parents:
diff changeset
42 with Ada.Streams;
kono
parents:
diff changeset
43
kono
parents:
diff changeset
44 package System.Stream_Attributes is
kono
parents:
diff changeset
45 pragma Preelaborate;
kono
parents:
diff changeset
46
kono
parents:
diff changeset
47 pragma Suppress (Accessibility_Check, Stream_Attributes);
kono
parents:
diff changeset
48 -- No need to check accessibility on arguments of subprograms
kono
parents:
diff changeset
49
kono
parents:
diff changeset
50 package UST renames System.Unsigned_Types;
kono
parents:
diff changeset
51
kono
parents:
diff changeset
52 subtype RST is Ada.Streams.Root_Stream_Type'Class;
kono
parents:
diff changeset
53
kono
parents:
diff changeset
54 subtype SEC is Ada.Streams.Stream_Element_Count;
kono
parents:
diff changeset
55
kono
parents:
diff changeset
56 -- Enumeration types are usually transferred using the routine for the
kono
parents:
diff changeset
57 -- corresponding integer. The exception is that special routines are
kono
parents:
diff changeset
58 -- provided for Boolean and the character types, in case the protocol
kono
parents:
diff changeset
59 -- in use provides specially for these types.
kono
parents:
diff changeset
60
kono
parents:
diff changeset
61 -- Access types use either a thin pointer (single address) or fat pointer
kono
parents:
diff changeset
62 -- (double address) form. The following types are used to hold access
kono
parents:
diff changeset
63 -- values using unchecked conversions.
kono
parents:
diff changeset
64
kono
parents:
diff changeset
65 type Thin_Pointer is record
kono
parents:
diff changeset
66 P1 : System.Address;
kono
parents:
diff changeset
67 end record;
kono
parents:
diff changeset
68
kono
parents:
diff changeset
69 type Fat_Pointer is record
kono
parents:
diff changeset
70 P1 : System.Address;
kono
parents:
diff changeset
71 P2 : System.Address;
kono
parents:
diff changeset
72 end record;
kono
parents:
diff changeset
73
kono
parents:
diff changeset
74 ------------------------------------
kono
parents:
diff changeset
75 -- Treatment of enumeration types --
kono
parents:
diff changeset
76 ------------------------------------
kono
parents:
diff changeset
77
kono
parents:
diff changeset
78 -- In this interface, there are no specific routines for general input
kono
parents:
diff changeset
79 -- or output of enumeration types. Generally, enumeration types whose
kono
parents:
diff changeset
80 -- representation is unsigned (no negative representation values) are
kono
parents:
diff changeset
81 -- treated as unsigned integers, and enumeration types that do have
kono
parents:
diff changeset
82 -- negative representation values are treated as signed integers.
kono
parents:
diff changeset
83
kono
parents:
diff changeset
84 -- An exception is that there are specialized routines for Boolean,
kono
parents:
diff changeset
85 -- Character, and Wide_Character types, but these specialized routines
kono
parents:
diff changeset
86 -- are used only if the type in question has a standard representation.
kono
parents:
diff changeset
87 -- For the case of a non-standard representation (one where the size of
kono
parents:
diff changeset
88 -- the first subtype is specified, or where an enumeration representation
kono
parents:
diff changeset
89 -- clause is given), these three types are treated like any other cases
kono
parents:
diff changeset
90 -- of enumeration types, as described above.
kono
parents:
diff changeset
91
kono
parents:
diff changeset
92 ---------------------
kono
parents:
diff changeset
93 -- Input Functions --
kono
parents:
diff changeset
94 ---------------------
kono
parents:
diff changeset
95
kono
parents:
diff changeset
96 -- Functions for S'Input attribute. These functions are also used for
kono
parents:
diff changeset
97 -- S'Read, with the obvious transformation, since the input operation
kono
parents:
diff changeset
98 -- is the same for all elementary types (no bounds or discriminants
kono
parents:
diff changeset
99 -- are involved).
kono
parents:
diff changeset
100
kono
parents:
diff changeset
101 function I_AD (Stream : not null access RST) return Fat_Pointer;
kono
parents:
diff changeset
102 function I_AS (Stream : not null access RST) return Thin_Pointer;
kono
parents:
diff changeset
103 function I_B (Stream : not null access RST) return Boolean;
kono
parents:
diff changeset
104 function I_C (Stream : not null access RST) return Character;
kono
parents:
diff changeset
105 function I_F (Stream : not null access RST) return Float;
kono
parents:
diff changeset
106 function I_I (Stream : not null access RST) return Integer;
kono
parents:
diff changeset
107 function I_LF (Stream : not null access RST) return Long_Float;
kono
parents:
diff changeset
108 function I_LI (Stream : not null access RST) return Long_Integer;
kono
parents:
diff changeset
109 function I_LLF (Stream : not null access RST) return Long_Long_Float;
kono
parents:
diff changeset
110 function I_LLI (Stream : not null access RST) return Long_Long_Integer;
kono
parents:
diff changeset
111 function I_LLU (Stream : not null access RST) return UST.Long_Long_Unsigned;
kono
parents:
diff changeset
112 function I_LU (Stream : not null access RST) return UST.Long_Unsigned;
kono
parents:
diff changeset
113 function I_SF (Stream : not null access RST) return Short_Float;
kono
parents:
diff changeset
114 function I_SI (Stream : not null access RST) return Short_Integer;
kono
parents:
diff changeset
115 function I_SSI (Stream : not null access RST) return Short_Short_Integer;
kono
parents:
diff changeset
116 function I_SSU (Stream : not null access RST) return
kono
parents:
diff changeset
117 UST.Short_Short_Unsigned;
kono
parents:
diff changeset
118 function I_SU (Stream : not null access RST) return UST.Short_Unsigned;
kono
parents:
diff changeset
119 function I_U (Stream : not null access RST) return UST.Unsigned;
kono
parents:
diff changeset
120 function I_WC (Stream : not null access RST) return Wide_Character;
kono
parents:
diff changeset
121 function I_WWC (Stream : not null access RST) return Wide_Wide_Character;
kono
parents:
diff changeset
122
kono
parents:
diff changeset
123 -----------------------
kono
parents:
diff changeset
124 -- Output Procedures --
kono
parents:
diff changeset
125 -----------------------
kono
parents:
diff changeset
126
kono
parents:
diff changeset
127 -- Procedures for S'Write attribute. These procedures are also used for
kono
parents:
diff changeset
128 -- 'Output, since for elementary types there is no difference between
kono
parents:
diff changeset
129 -- 'Write and 'Output because there are no discriminants or bounds to
kono
parents:
diff changeset
130 -- be written.
kono
parents:
diff changeset
131
kono
parents:
diff changeset
132 procedure W_AD (Stream : not null access RST; Item : Fat_Pointer);
kono
parents:
diff changeset
133 procedure W_AS (Stream : not null access RST; Item : Thin_Pointer);
kono
parents:
diff changeset
134 procedure W_B (Stream : not null access RST; Item : Boolean);
kono
parents:
diff changeset
135 procedure W_C (Stream : not null access RST; Item : Character);
kono
parents:
diff changeset
136 procedure W_F (Stream : not null access RST; Item : Float);
kono
parents:
diff changeset
137 procedure W_I (Stream : not null access RST; Item : Integer);
kono
parents:
diff changeset
138 procedure W_LF (Stream : not null access RST; Item : Long_Float);
kono
parents:
diff changeset
139 procedure W_LI (Stream : not null access RST; Item : Long_Integer);
kono
parents:
diff changeset
140 procedure W_LLF (Stream : not null access RST; Item : Long_Long_Float);
kono
parents:
diff changeset
141 procedure W_LLI (Stream : not null access RST; Item : Long_Long_Integer);
kono
parents:
diff changeset
142 procedure W_LLU (Stream : not null access RST; Item :
kono
parents:
diff changeset
143 UST.Long_Long_Unsigned);
kono
parents:
diff changeset
144 procedure W_LU (Stream : not null access RST; Item : UST.Long_Unsigned);
kono
parents:
diff changeset
145 procedure W_SF (Stream : not null access RST; Item : Short_Float);
kono
parents:
diff changeset
146 procedure W_SI (Stream : not null access RST; Item : Short_Integer);
kono
parents:
diff changeset
147 procedure W_SSI (Stream : not null access RST; Item : Short_Short_Integer);
kono
parents:
diff changeset
148 procedure W_SSU (Stream : not null access RST; Item :
kono
parents:
diff changeset
149 UST.Short_Short_Unsigned);
kono
parents:
diff changeset
150 procedure W_SU (Stream : not null access RST; Item : UST.Short_Unsigned);
kono
parents:
diff changeset
151 procedure W_U (Stream : not null access RST; Item : UST.Unsigned);
kono
parents:
diff changeset
152 procedure W_WC (Stream : not null access RST; Item : Wide_Character);
kono
parents:
diff changeset
153 procedure W_WWC (Stream : not null access RST; Item : Wide_Wide_Character);
kono
parents:
diff changeset
154
kono
parents:
diff changeset
155 function Block_IO_OK return Boolean;
kono
parents:
diff changeset
156 -- Package System.Stream_Attributes has several bodies - the default one
kono
parents:
diff changeset
157 -- distributed with GNAT, and s-stratt-xdr.adb, which is based on the XDR
kono
parents:
diff changeset
158 -- standard. Both bodies share the same spec. The role of this function is
kono
parents:
diff changeset
159 -- to indicate whether the current version of System.Stream_Attributes
kono
parents:
diff changeset
160 -- supports block IO. See System.Strings.Stream_Ops (s-ststop) for details.
kono
parents:
diff changeset
161
kono
parents:
diff changeset
162 private
kono
parents:
diff changeset
163 pragma Inline (I_AD);
kono
parents:
diff changeset
164 pragma Inline (I_AS);
kono
parents:
diff changeset
165 pragma Inline (I_B);
kono
parents:
diff changeset
166 pragma Inline (I_C);
kono
parents:
diff changeset
167 pragma Inline (I_F);
kono
parents:
diff changeset
168 pragma Inline (I_I);
kono
parents:
diff changeset
169 pragma Inline (I_LF);
kono
parents:
diff changeset
170 pragma Inline (I_LI);
kono
parents:
diff changeset
171 pragma Inline (I_LLF);
kono
parents:
diff changeset
172 pragma Inline (I_LLI);
kono
parents:
diff changeset
173 pragma Inline (I_LLU);
kono
parents:
diff changeset
174 pragma Inline (I_LU);
kono
parents:
diff changeset
175 pragma Inline (I_SF);
kono
parents:
diff changeset
176 pragma Inline (I_SI);
kono
parents:
diff changeset
177 pragma Inline (I_SSI);
kono
parents:
diff changeset
178 pragma Inline (I_SSU);
kono
parents:
diff changeset
179 pragma Inline (I_SU);
kono
parents:
diff changeset
180 pragma Inline (I_U);
kono
parents:
diff changeset
181 pragma Inline (I_WC);
kono
parents:
diff changeset
182 pragma Inline (I_WWC);
kono
parents:
diff changeset
183
kono
parents:
diff changeset
184 pragma Inline (W_AD);
kono
parents:
diff changeset
185 pragma Inline (W_AS);
kono
parents:
diff changeset
186 pragma Inline (W_B);
kono
parents:
diff changeset
187 pragma Inline (W_C);
kono
parents:
diff changeset
188 pragma Inline (W_F);
kono
parents:
diff changeset
189 pragma Inline (W_I);
kono
parents:
diff changeset
190 pragma Inline (W_LF);
kono
parents:
diff changeset
191 pragma Inline (W_LI);
kono
parents:
diff changeset
192 pragma Inline (W_LLF);
kono
parents:
diff changeset
193 pragma Inline (W_LLI);
kono
parents:
diff changeset
194 pragma Inline (W_LLU);
kono
parents:
diff changeset
195 pragma Inline (W_LU);
kono
parents:
diff changeset
196 pragma Inline (W_SF);
kono
parents:
diff changeset
197 pragma Inline (W_SI);
kono
parents:
diff changeset
198 pragma Inline (W_SSI);
kono
parents:
diff changeset
199 pragma Inline (W_SSU);
kono
parents:
diff changeset
200 pragma Inline (W_SU);
kono
parents:
diff changeset
201 pragma Inline (W_U);
kono
parents:
diff changeset
202 pragma Inline (W_WC);
kono
parents:
diff changeset
203 pragma Inline (W_WWC);
kono
parents:
diff changeset
204
kono
parents:
diff changeset
205 pragma Inline (Block_IO_OK);
kono
parents:
diff changeset
206
kono
parents:
diff changeset
207 end System.Stream_Attributes;