annotate gcc/ada/libgnat/a-cofuba.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 -- ADA.CONTAINERS.FUNCTIONAL_BASE --
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) 2016-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 -- Functional containers are neither controlled nor limited. This is safe, as
kono
parents:
diff changeset
32 -- no primitives are provided to modify them.
kono
parents:
diff changeset
33 -- Memory allocated inside functional containers is never reclaimed.
kono
parents:
diff changeset
34
kono
parents:
diff changeset
35 pragma Ada_2012;
kono
parents:
diff changeset
36
kono
parents:
diff changeset
37 private generic
kono
parents:
diff changeset
38 type Index_Type is (<>);
kono
parents:
diff changeset
39 -- To avoid Constraint_Error being raised at run time, Index_Type'Base
kono
parents:
diff changeset
40 -- should have at least one more element at the low end than Index_Type.
kono
parents:
diff changeset
41
kono
parents:
diff changeset
42 type Element_Type (<>) is private;
kono
parents:
diff changeset
43 with function "=" (Left, Right : Element_Type) return Boolean is <>;
kono
parents:
diff changeset
44
kono
parents:
diff changeset
45 package Ada.Containers.Functional_Base with SPARK_Mode => Off is
kono
parents:
diff changeset
46
kono
parents:
diff changeset
47 subtype Extended_Index is Index_Type'Base range
kono
parents:
diff changeset
48 Index_Type'Pred (Index_Type'First) .. Index_Type'Last;
kono
parents:
diff changeset
49
kono
parents:
diff changeset
50 type Container is private;
kono
parents:
diff changeset
51
kono
parents:
diff changeset
52 function "=" (C1 : Container; C2 : Container) return Boolean;
kono
parents:
diff changeset
53 -- Return True if C1 and C2 contain the same elements at the same position
kono
parents:
diff changeset
54
kono
parents:
diff changeset
55 function Length (C : Container) return Count_Type;
kono
parents:
diff changeset
56 -- Number of elements stored in C
kono
parents:
diff changeset
57
kono
parents:
diff changeset
58 function Get (C : Container; I : Index_Type) return Element_Type;
kono
parents:
diff changeset
59 -- Access to the element at index I in C
kono
parents:
diff changeset
60
kono
parents:
diff changeset
61 function Set
kono
parents:
diff changeset
62 (C : Container;
kono
parents:
diff changeset
63 I : Index_Type;
kono
parents:
diff changeset
64 E : Element_Type) return Container;
kono
parents:
diff changeset
65 -- Return a new container which is equal to C except for the element at
kono
parents:
diff changeset
66 -- index I, which is set to E.
kono
parents:
diff changeset
67
kono
parents:
diff changeset
68 function Add
kono
parents:
diff changeset
69 (C : Container;
kono
parents:
diff changeset
70 I : Index_Type;
kono
parents:
diff changeset
71 E : Element_Type) return Container;
kono
parents:
diff changeset
72 -- Return a new container that is C with E inserted at index I
kono
parents:
diff changeset
73
kono
parents:
diff changeset
74 function Remove (C : Container; I : Index_Type) return Container;
kono
parents:
diff changeset
75 -- Return a new container that is C without the element at index I
kono
parents:
diff changeset
76
kono
parents:
diff changeset
77 function Find (C : Container; E : Element_Type) return Extended_Index;
kono
parents:
diff changeset
78 -- Return the first index for which the element stored in C is I. If there
kono
parents:
diff changeset
79 -- are no such indexes, return Extended_Index'First.
kono
parents:
diff changeset
80
kono
parents:
diff changeset
81 --------------------
kono
parents:
diff changeset
82 -- Set Operations --
kono
parents:
diff changeset
83 --------------------
kono
parents:
diff changeset
84
kono
parents:
diff changeset
85 function "<=" (C1 : Container; C2 : Container) return Boolean;
kono
parents:
diff changeset
86 -- Return True if every element of C1 is in C2
kono
parents:
diff changeset
87
kono
parents:
diff changeset
88 function Num_Overlaps (C1 : Container; C2 : Container) return Count_Type;
kono
parents:
diff changeset
89 -- Return the number of elements that are in both C1 and C2
kono
parents:
diff changeset
90
kono
parents:
diff changeset
91 function Union (C1 : Container; C2 : Container) return Container;
kono
parents:
diff changeset
92 -- Return a container which is C1 plus all the elements of C2 that are not
kono
parents:
diff changeset
93 -- in C1.
kono
parents:
diff changeset
94
kono
parents:
diff changeset
95 function Intersection (C1 : Container; C2 : Container) return Container;
kono
parents:
diff changeset
96 -- Return a container which is C1 minus all the elements that are also in
kono
parents:
diff changeset
97 -- C2.
kono
parents:
diff changeset
98
kono
parents:
diff changeset
99 private
kono
parents:
diff changeset
100
kono
parents:
diff changeset
101 subtype Positive_Count_Type is Count_Type range 1 .. Count_Type'Last;
kono
parents:
diff changeset
102
kono
parents:
diff changeset
103 type Element_Access is access all Element_Type;
kono
parents:
diff changeset
104
kono
parents:
diff changeset
105 type Element_Array is
kono
parents:
diff changeset
106 array (Positive_Count_Type range <>) of Element_Access;
kono
parents:
diff changeset
107
kono
parents:
diff changeset
108 type Element_Array_Access is not null access Element_Array;
kono
parents:
diff changeset
109
kono
parents:
diff changeset
110 Empty_Element_Array_Access : constant Element_Array_Access :=
kono
parents:
diff changeset
111 new Element_Array'(1 .. 0 => null);
kono
parents:
diff changeset
112
kono
parents:
diff changeset
113 type Container is record
kono
parents:
diff changeset
114 Elements : Element_Array_Access := Empty_Element_Array_Access;
kono
parents:
diff changeset
115 end record;
kono
parents:
diff changeset
116
kono
parents:
diff changeset
117 end Ada.Containers.Functional_Base;