OSDN Git Service

Remove duplicate entries.
[pf3gnuchains/gcc-fork.git] / gcc / ada / a-cforma.ads
index 2ddefeb..145ff51 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 2004-2010, Free Software Foundation, Inc.         --
+--          Copyright (C) 2004-2011, Free Software Foundation, Inc.         --
 --                                                                          --
 -- This specification is derived from the Ada Reference Manual for use with --
 -- GNAT. The copyright notice above, and the license provisions that follow --
 --    container. The operators "<" and ">" that could not be modified that way
 --    have been removed.
 
---    There are two new functions:
+--    There are four new functions:
 
+--      function Strict_Equal (Left, Right : Map) return Boolean;
+--      function Overlap (Left, Right : Map) return Boolean;
 --      function Left  (Container : Map; Position : Cursor) return Map;
 --      function Right (Container : Map; Position : Cursor) return Map;
 
---      Left returns a container containing all elements preceding Position
---      (excluded) in Container. Right returns a container containing all
---      elements following Position (included) in Container. These two new
---      functions are useful to express invariant properties in loops which
---      iterate over containers. Left returns the part of the container already
---      scanned and Right the part not scanned yet.
+--    See detailed specifications for these subprograms
 
 private with Ada.Containers.Red_Black_Trees;
 private with Ada.Streams;
-with Ada.Containers;
 
 generic
    type Key_Type is private;
@@ -73,7 +69,7 @@ package Ada.Containers.Formal_Ordered_Maps is
    function Equivalent_Keys (Left, Right : Key_Type) return Boolean;
 
    type Map (Capacity : Count_Type) is tagged private;
-   --  pragma Preelaborable_Initialization (Map);
+   pragma Preelaborable_Initialization (Map);
 
    type Cursor is private;
    pragma Preelaborable_Initialization (Cursor);
@@ -198,13 +194,21 @@ package Ada.Containers.Formal_Ordered_Maps is
                     procedure (Container : Map; Position : Cursor));
 
    function Strict_Equal (Left, Right : Map) return Boolean;
+   --  Strict_Equal returns True if the containers are physically equal, i.e.
+   --  they are structurally equal (function "=" returns True) and that they
+   --  have the same set of cursors.
 
-   function Left (Container : Map; Position : Cursor) return Map;
-
+   function Left  (Container : Map; Position : Cursor) return Map;
    function Right (Container : Map; Position : Cursor) return Map;
+   --  Left returns a container containing all elements preceding Position
+   --  (excluded) in Container. Right returns a container containing all
+   --  elements following Position (included) in Container. These two new
+   --  functions can be used to express invariant properties in loops which
+   --  iterate over containers. Left returns the part of the container already
+   --  scanned and Right the part not scanned yet.
 
    function Overlap (Left, Right : Map) return Boolean;
-
+   --  Overlap returns True if the containers have common keys
 private
 
    pragma Inline (Next);
@@ -216,34 +220,22 @@ private
 
    type Node_Type is record
       Has_Element : Boolean := False;
-      Parent  : Node_Access;
-      Left    : Node_Access;
-      Right   : Node_Access;
+      Parent  : Node_Access := 0;
+      Left    : Node_Access := 0;
+      Right   : Node_Access := 0;
       Color   : Red_Black_Trees.Color_Type := Red;
       Key     : Key_Type;
       Element : Element_Type;
    end record;
 
-   type Kind is (Plain, Part);
-
    package Tree_Types is
      new Ada.Containers.Red_Black_Trees.Generic_Bounded_Tree_Types (Node_Type);
 
-   type Tree_Type_Access is access all Tree_Types.Tree_Type;
-
-   type Map (Capacity : Count_Type) is tagged record
-      Tree   : Tree_Type_Access := new Tree_Types.Tree_Type (Capacity);
-      K      : Kind := Plain;
-      Length : Count_Type := 0;
-      First  : Count_Type := 0;
-      Last   : Count_Type := 0;
-   end record;
+   type Map (Capacity : Count_Type) is
+      new Tree_Types.Tree_Type (Capacity) with null record;
 
    use Ada.Streams;
 
-   type Map_Access is access all Map;
-   for Map_Access'Storage_Size use 0;
-
    type Cursor is record
       Node : Node_Access;
    end record;