annotate gcc/ada/libgnat/a-coinho.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 LIBRARY COMPONENTS --
kono
parents:
diff changeset
4 -- --
kono
parents:
diff changeset
5 -- A D A . C O N T A I N E R S . I N D E F I N I T E _ H O L D E R 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) 2011-2018, Free Software Foundation, Inc. --
111
kono
parents:
diff changeset
10 -- --
kono
parents:
diff changeset
11 -- This specification is derived from the Ada Reference Manual for use with --
kono
parents:
diff changeset
12 -- GNAT. The copyright notice above, and the license provisions that follow --
kono
parents:
diff changeset
13 -- apply solely to the contents of the part following the private keyword. --
kono
parents:
diff changeset
14 -- --
kono
parents:
diff changeset
15 -- GNAT is free software; you can redistribute it and/or modify it under --
kono
parents:
diff changeset
16 -- terms of the GNU General Public License as published by the Free Soft- --
kono
parents:
diff changeset
17 -- ware Foundation; either version 3, or (at your option) any later ver- --
kono
parents:
diff changeset
18 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
kono
parents:
diff changeset
19 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
kono
parents:
diff changeset
20 -- or FITNESS FOR A PARTICULAR PURPOSE. --
kono
parents:
diff changeset
21 -- --
kono
parents:
diff changeset
22 -- As a special exception under Section 7 of GPL version 3, you are granted --
kono
parents:
diff changeset
23 -- additional permissions described in the GCC Runtime Library Exception, --
kono
parents:
diff changeset
24 -- version 3.1, as published by the Free Software Foundation. --
kono
parents:
diff changeset
25 -- --
kono
parents:
diff changeset
26 -- You should have received a copy of the GNU General Public License and --
kono
parents:
diff changeset
27 -- a copy of the GCC Runtime Library Exception along with this program; --
kono
parents:
diff changeset
28 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
kono
parents:
diff changeset
29 -- <http://www.gnu.org/licenses/>. --
kono
parents:
diff changeset
30 ------------------------------------------------------------------------------
kono
parents:
diff changeset
31
kono
parents:
diff changeset
32 private with Ada.Finalization;
kono
parents:
diff changeset
33 private with Ada.Streams;
kono
parents:
diff changeset
34
kono
parents:
diff changeset
35 generic
kono
parents:
diff changeset
36 type Element_Type (<>) is private;
kono
parents:
diff changeset
37 with function "=" (Left, Right : Element_Type) return Boolean is <>;
kono
parents:
diff changeset
38
kono
parents:
diff changeset
39 package Ada.Containers.Indefinite_Holders is
kono
parents:
diff changeset
40 pragma Annotate (CodePeer, Skip_Analysis);
kono
parents:
diff changeset
41 pragma Preelaborate (Indefinite_Holders);
kono
parents:
diff changeset
42 pragma Remote_Types (Indefinite_Holders);
kono
parents:
diff changeset
43
kono
parents:
diff changeset
44 type Holder is tagged private;
kono
parents:
diff changeset
45 pragma Preelaborable_Initialization (Holder);
kono
parents:
diff changeset
46
kono
parents:
diff changeset
47 Empty_Holder : constant Holder;
kono
parents:
diff changeset
48
kono
parents:
diff changeset
49 function "=" (Left, Right : Holder) return Boolean;
kono
parents:
diff changeset
50
kono
parents:
diff changeset
51 function To_Holder (New_Item : Element_Type) return Holder;
kono
parents:
diff changeset
52
kono
parents:
diff changeset
53 function Is_Empty (Container : Holder) return Boolean;
kono
parents:
diff changeset
54
kono
parents:
diff changeset
55 procedure Clear (Container : in out Holder);
kono
parents:
diff changeset
56
kono
parents:
diff changeset
57 function Element (Container : Holder) return Element_Type;
kono
parents:
diff changeset
58
kono
parents:
diff changeset
59 procedure Replace_Element
kono
parents:
diff changeset
60 (Container : in out Holder;
kono
parents:
diff changeset
61 New_Item : Element_Type);
kono
parents:
diff changeset
62
kono
parents:
diff changeset
63 procedure Query_Element
kono
parents:
diff changeset
64 (Container : Holder;
kono
parents:
diff changeset
65 Process : not null access procedure (Element : Element_Type));
kono
parents:
diff changeset
66
kono
parents:
diff changeset
67 procedure Update_Element
kono
parents:
diff changeset
68 (Container : in out Holder;
kono
parents:
diff changeset
69 Process : not null access procedure (Element : in out Element_Type));
kono
parents:
diff changeset
70
kono
parents:
diff changeset
71 type Constant_Reference_Type
kono
parents:
diff changeset
72 (Element : not null access constant Element_Type) is private
kono
parents:
diff changeset
73 with
kono
parents:
diff changeset
74 Implicit_Dereference => Element;
kono
parents:
diff changeset
75
kono
parents:
diff changeset
76 type Reference_Type
kono
parents:
diff changeset
77 (Element : not null access Element_Type) is private
kono
parents:
diff changeset
78 with
kono
parents:
diff changeset
79 Implicit_Dereference => Element;
kono
parents:
diff changeset
80
kono
parents:
diff changeset
81 function Constant_Reference
kono
parents:
diff changeset
82 (Container : aliased Holder) return Constant_Reference_Type;
kono
parents:
diff changeset
83 pragma Inline (Constant_Reference);
kono
parents:
diff changeset
84
kono
parents:
diff changeset
85 function Reference
kono
parents:
diff changeset
86 (Container : aliased in out Holder) return Reference_Type;
kono
parents:
diff changeset
87 pragma Inline (Reference);
kono
parents:
diff changeset
88
kono
parents:
diff changeset
89 procedure Assign (Target : in out Holder; Source : Holder);
kono
parents:
diff changeset
90
kono
parents:
diff changeset
91 function Copy (Source : Holder) return Holder;
kono
parents:
diff changeset
92
kono
parents:
diff changeset
93 procedure Move (Target : in out Holder; Source : in out Holder);
kono
parents:
diff changeset
94
kono
parents:
diff changeset
95 private
kono
parents:
diff changeset
96
kono
parents:
diff changeset
97 use Ada.Finalization;
kono
parents:
diff changeset
98 use Ada.Streams;
kono
parents:
diff changeset
99
kono
parents:
diff changeset
100 type Element_Access is access all Element_Type;
kono
parents:
diff changeset
101
kono
parents:
diff changeset
102 type Holder_Access is access all Holder;
kono
parents:
diff changeset
103 for Holder_Access'Storage_Size use 0;
kono
parents:
diff changeset
104
kono
parents:
diff changeset
105 procedure Read
kono
parents:
diff changeset
106 (Stream : not null access Ada.Streams.Root_Stream_Type'Class;
kono
parents:
diff changeset
107 Container : out Holder);
kono
parents:
diff changeset
108
kono
parents:
diff changeset
109 procedure Write
kono
parents:
diff changeset
110 (Stream : not null access Ada.Streams.Root_Stream_Type'Class;
kono
parents:
diff changeset
111 Container : Holder);
kono
parents:
diff changeset
112
kono
parents:
diff changeset
113 type Holder is new Ada.Finalization.Controlled with record
kono
parents:
diff changeset
114 Element : Element_Access;
kono
parents:
diff changeset
115 Busy : Natural := 0;
kono
parents:
diff changeset
116 end record;
kono
parents:
diff changeset
117 for Holder'Read use Read;
kono
parents:
diff changeset
118 for Holder'Write use Write;
kono
parents:
diff changeset
119
kono
parents:
diff changeset
120 overriding procedure Adjust (Container : in out Holder);
kono
parents:
diff changeset
121 overriding procedure Finalize (Container : in out Holder);
kono
parents:
diff changeset
122
kono
parents:
diff changeset
123 type Reference_Control_Type is new Controlled with
kono
parents:
diff changeset
124 record
kono
parents:
diff changeset
125 Container : Holder_Access;
kono
parents:
diff changeset
126 end record;
kono
parents:
diff changeset
127
kono
parents:
diff changeset
128 overriding procedure Adjust (Control : in out Reference_Control_Type);
kono
parents:
diff changeset
129 pragma Inline (Adjust);
kono
parents:
diff changeset
130
kono
parents:
diff changeset
131 overriding procedure Finalize (Control : in out Reference_Control_Type);
kono
parents:
diff changeset
132 pragma Inline (Finalize);
kono
parents:
diff changeset
133
kono
parents:
diff changeset
134 type Constant_Reference_Type
kono
parents:
diff changeset
135 (Element : not null access constant Element_Type) is
kono
parents:
diff changeset
136 record
kono
parents:
diff changeset
137 Control : Reference_Control_Type :=
kono
parents:
diff changeset
138 raise Program_Error with "uninitialized reference";
kono
parents:
diff changeset
139 -- The RM says, "The default initialization of an object of
kono
parents:
diff changeset
140 -- type Constant_Reference_Type or Reference_Type propagates
kono
parents:
diff changeset
141 -- Program_Error."
kono
parents:
diff changeset
142 end record;
kono
parents:
diff changeset
143
kono
parents:
diff changeset
144 procedure Write
kono
parents:
diff changeset
145 (Stream : not null access Root_Stream_Type'Class;
kono
parents:
diff changeset
146 Item : Constant_Reference_Type);
kono
parents:
diff changeset
147
kono
parents:
diff changeset
148 for Constant_Reference_Type'Write use Write;
kono
parents:
diff changeset
149
kono
parents:
diff changeset
150 procedure Read
kono
parents:
diff changeset
151 (Stream : not null access Root_Stream_Type'Class;
kono
parents:
diff changeset
152 Item : out Constant_Reference_Type);
kono
parents:
diff changeset
153
kono
parents:
diff changeset
154 for Constant_Reference_Type'Read use Read;
kono
parents:
diff changeset
155
kono
parents:
diff changeset
156 type Reference_Type (Element : not null access Element_Type) is record
kono
parents:
diff changeset
157 Control : Reference_Control_Type :=
kono
parents:
diff changeset
158 raise Program_Error with "uninitialized reference";
kono
parents:
diff changeset
159 -- The RM says, "The default initialization of an object of
kono
parents:
diff changeset
160 -- type Constant_Reference_Type or Reference_Type propagates
kono
parents:
diff changeset
161 -- Program_Error."
kono
parents:
diff changeset
162 end record;
kono
parents:
diff changeset
163
kono
parents:
diff changeset
164 procedure Write
kono
parents:
diff changeset
165 (Stream : not null access Root_Stream_Type'Class;
kono
parents:
diff changeset
166 Item : Reference_Type);
kono
parents:
diff changeset
167
kono
parents:
diff changeset
168 for Reference_Type'Write use Write;
kono
parents:
diff changeset
169
kono
parents:
diff changeset
170 procedure Read
kono
parents:
diff changeset
171 (Stream : not null access Root_Stream_Type'Class;
kono
parents:
diff changeset
172 Item : out Reference_Type);
kono
parents:
diff changeset
173
kono
parents:
diff changeset
174 for Reference_Type'Read use Read;
kono
parents:
diff changeset
175
kono
parents:
diff changeset
176 Empty_Holder : constant Holder := (Controlled with null, 0);
kono
parents:
diff changeset
177
kono
parents:
diff changeset
178 end Ada.Containers.Indefinite_Holders;