-- --
-- 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. --
------------------------------------------------------------------------------
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
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
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
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
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);
----------
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);
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);
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
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
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);
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
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;
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
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
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
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");
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");