OSDN Git Service

2010-10-26 Jerry DeLisle <jvdelisle@gcc.gnu.org>
[pf3gnuchains/gcc-fork.git] / gcc / ada / a-cidlli.adb
index 72057db..8d1f8e3 100644 (file)
@@ -6,25 +6,23 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 2004-2008, Free Software Foundation, Inc.         --
+--          Copyright (C) 2004-2010, Free Software Foundation, Inc.         --
 --                                                                          --
 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
 -- terms of the  GNU General Public License as published  by the Free Soft- --
--- ware  Foundation;  either version 2,  or (at your option) any later ver- --
+-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
 -- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
 -- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
--- for  more details.  You should have  received  a copy of the GNU General --
--- Public License  distributed with GNAT;  see file COPYING.  If not, write --
--- to  the  Free Software Foundation,  51  Franklin  Street,  Fifth  Floor, --
--- Boston, MA 02110-1301, USA.                                              --
+-- or FITNESS FOR A PARTICULAR PURPOSE.                                     --
 --                                                                          --
--- As a special exception,  if other files  instantiate  generics from this --
--- unit, or you link  this unit with other files  to produce an executable, --
--- this  unit  does not  by itself cause  the resulting  executable  to  be --
--- covered  by the  GNU  General  Public  License.  This exception does not --
--- however invalidate  any other reasons why  the executable file  might be --
--- covered by the  GNU Public License.                                      --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception,   --
+-- version 3.1, as published by the Free Software Foundation.               --
+--                                                                          --
+-- You should have received a copy of the GNU General Public License and    --
+-- a copy of the GCC Runtime Library Exception along with this program;     --
+-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
+-- <http://www.gnu.org/licenses/>.                                          --
 --                                                                          --
 -- This unit was originally developed by Matthew J Heaney.                  --
 ------------------------------------------------------------------------------
@@ -177,7 +175,7 @@ package body Ada.Containers.Indefinite_Doubly_Linked_Lists is
 
       if Container.Busy > 0 then
          raise Program_Error with
-           "attempt to tamper with elements (list is busy)";
+           "attempt to tamper with cursors (list is busy)";
       end if;
 
       while Container.Length > 1 loop
@@ -256,7 +254,7 @@ package body Ada.Containers.Indefinite_Doubly_Linked_Lists is
 
       if Container.Busy > 0 then
          raise Program_Error with
-           "attempt to tamper with elements (list is busy)";
+           "attempt to tamper with cursors (list is busy)";
       end if;
 
       for Index in 1 .. Count loop
@@ -306,7 +304,7 @@ package body Ada.Containers.Indefinite_Doubly_Linked_Lists is
 
       if Container.Busy > 0 then
          raise Program_Error with
-           "attempt to tamper with elements (list is busy)";
+           "attempt to tamper with cursors (list is busy)";
       end if;
 
       for I in 1 .. Count loop
@@ -344,7 +342,7 @@ package body Ada.Containers.Indefinite_Doubly_Linked_Lists is
 
       if Container.Busy > 0 then
          raise Program_Error with
-           "attempt to tamper with elements (list is busy)";
+           "attempt to tamper with cursors (list is busy)";
       end if;
 
       for I in 1 .. Count loop
@@ -512,12 +510,12 @@ package body Ada.Containers.Indefinite_Doubly_Linked_Lists is
 
          if Target.Busy > 0 then
             raise Program_Error with
-              "attempt to tamper with elements of Target (list is busy)";
+              "attempt to tamper with cursors of Target (list is busy)";
          end if;
 
          if Source.Busy > 0 then
             raise Program_Error with
-              "attempt to tamper with elements of Source (list is busy)";
+              "attempt to tamper with cursors of Source (list is busy)";
          end if;
 
          LI := First (Target);
@@ -607,15 +605,9 @@ package body Ada.Containers.Indefinite_Doubly_Linked_Lists is
          ----------
 
          procedure Sort (Front, Back : Node_Access) is
-            Pivot : Node_Access;
-
+            Pivot : constant Node_Access :=
+                      (if Front = null then Container.First else Front.Next);
          begin
-            if Front = null then
-               Pivot := Container.First;
-            else
-               Pivot := Front.Next;
-            end if;
-
             if Pivot /= Back then
                Partition (Pivot, Back);
                Sort (Front, Pivot);
@@ -635,7 +627,7 @@ package body Ada.Containers.Indefinite_Doubly_Linked_Lists is
 
          if Container.Busy > 0 then
             raise Program_Error with
-              "attempt to tamper with elements (list is busy)";
+              "attempt to tamper with cursors (list is busy)";
          end if;
 
          Sort (Front => null, Back => null);
@@ -673,7 +665,7 @@ package body Ada.Containers.Indefinite_Doubly_Linked_Lists is
       if Before.Container /= null then
          if Before.Container /= Container'Unrestricted_Access then
             raise Program_Error with
-              "attempt to tamper with elements (list is busy)";
+              "attempt to tamper with cursors (list is busy)";
          end if;
 
          if Before.Node = null
@@ -697,7 +689,7 @@ package body Ada.Containers.Indefinite_Doubly_Linked_Lists is
 
       if Container.Busy > 0 then
          raise Program_Error with
-           "attempt to tamper with elements (list is busy)";
+           "attempt to tamper with cursors (list is busy)";
       end if;
 
       declare
@@ -875,7 +867,7 @@ package body Ada.Containers.Indefinite_Doubly_Linked_Lists is
 
       if Source.Busy > 0 then
          raise Program_Error with
-           "attempt to tamper with elements of Source (list is busy)";
+           "attempt to tamper with cursors of Source (list is busy)";
       end if;
 
       Clear (Target);
@@ -1085,7 +1077,7 @@ package body Ada.Containers.Indefinite_Doubly_Linked_Lists is
 
       if Container.Lock > 0 then
          raise Program_Error with
-           "attempt to tamper with cursors (list is locked)";
+           "attempt to tamper with elements (list is locked)";
       end if;
 
       if Position.Node.Element = null then
@@ -1164,7 +1156,7 @@ package body Ada.Containers.Indefinite_Doubly_Linked_Lists is
 
       if Container.Busy > 0 then
          raise Program_Error with
-           "attempt to tamper with elements (list is busy)";
+           "attempt to tamper with cursors (list is busy)";
       end if;
 
       Container.First := J;
@@ -1301,12 +1293,12 @@ package body Ada.Containers.Indefinite_Doubly_Linked_Lists is
 
       if Target.Busy > 0 then
          raise Program_Error with
-           "attempt to tamper with elements of Target (list is busy)";
+           "attempt to tamper with cursors of Target (list is busy)";
       end if;
 
       if Source.Busy > 0 then
          raise Program_Error with
-           "attempt to tamper with elements of Source (list is busy)";
+           "attempt to tamper with cursors of Source (list is busy)";
       end if;
 
       if Target.Length = 0 then
@@ -1396,7 +1388,7 @@ package body Ada.Containers.Indefinite_Doubly_Linked_Lists is
 
       if Container.Busy > 0 then
          raise Program_Error with
-           "attempt to tamper with elements (list is busy)";
+           "attempt to tamper with cursors (list is busy)";
       end if;
 
       if Before.Node = null then
@@ -1512,12 +1504,12 @@ package body Ada.Containers.Indefinite_Doubly_Linked_Lists is
 
       if Target.Busy > 0 then
          raise Program_Error with
-           "attempt to tamper with elements of Target (list is busy)";
+           "attempt to tamper with cursors of Target (list is busy)";
       end if;
 
       if Source.Busy > 0 then
          raise Program_Error with
-           "attempt to tamper with elements of Source (list is busy)";
+           "attempt to tamper with cursors of Source (list is busy)";
       end if;
 
       if Position.Node = Source.First then
@@ -1616,7 +1608,7 @@ package body Ada.Containers.Indefinite_Doubly_Linked_Lists is
 
       if Container.Lock > 0 then
          raise Program_Error with
-           "attempt to tamper with cursors (list is locked)";
+           "attempt to tamper with elements (list is locked)";
       end if;
 
       pragma Assert (Vet (I), "bad I cursor in Swap");
@@ -1662,7 +1654,7 @@ package body Ada.Containers.Indefinite_Doubly_Linked_Lists is
 
       if Container.Busy > 0 then
          raise Program_Error with
-           "attempt to tamper with elements (list is busy)";
+           "attempt to tamper with cursors (list is busy)";
       end if;
 
       pragma Assert (Vet (I), "bad I cursor in Swap_Links");