Commit 1ed69f61 by Arnaud Charlet

a-cgcaso.adb, [...]: (Swap, Sift): Avoid use of complex renaming.

2008-04-08  Arnaud Charlet  <charlet@adacore.com>
	    Matthew Heaney  <heaney@adacore.com>

	* a-cgcaso.adb, a-convec.adb: (Swap, Sift): Avoid use of complex
	renaming.

	* a-cgaaso.ads, a-secain.ads, a-slcain.ads, a-shcain.ads,  
	a-crdlli.ads, a-coormu.ads, a-ciormu.ads: modified header to conform
	to convention for non-RM specs.
	Add descriptive header, and documented each operation
	document each operation

From-SVN: r134009
parent 43c6e0cb
......@@ -6,11 +6,7 @@
-- --
-- S p e c --
-- --
-- Copyright (C) 2004-2007, 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 --
-- apply solely to the contents of the part following the private keyword. --
-- Copyright (C) 2004-2008, 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- --
......@@ -33,7 +29,9 @@
-- This unit was originally developed by Matthew J Heaney. --
------------------------------------------------------------------------------
-- Documentation of this unit is needed ???
-- Allows an anonymous array (or array-like container) to be sorted. Generic
-- formal Less returns the result of comparing the elements designated by the
-- indices, and generic formal Swap exchanges the designated elements.
generic
type Index_Type is (<>);
......@@ -42,5 +40,4 @@ generic
procedure Ada.Containers.Generic_Anonymous_Array_Sort
(First, Last : Index_Type'Base);
pragma Pure (Ada.Containers.Generic_Anonymous_Array_Sort);
......@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 2004-2007, Free Software Foundation, Inc. --
-- Copyright (C) 2004-2008, 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- --
......@@ -92,13 +92,10 @@ is
while C /= S loop
declare
Father : constant T := C / 2;
Father_Elem : Element_Type renames A (To_Index (Father));
begin
if Father_Elem < Temp then -- Lt (Father, 0)
A (To_Index (C)) := Father_Elem; -- Move (Father, C)
if A (To_Index (Father)) < Temp then -- Lt (Father, 0)
A (To_Index (C)) := A (To_Index (Father)); -- Move (Father, C)
C := Father;
else
exit;
end if;
......@@ -117,12 +114,8 @@ begin
end loop;
while Max > 1 loop
declare
Max_Elem : Element_Type renames A (To_Index (Max));
begin
Temp := Max_Elem; -- Move (Max, 0);
Max_Elem := A (A'First); -- Move (1, Max);
end;
Temp := A (To_Index (Max)); -- Move (Max, 0);
A (To_Index (Max)) := A (A'First); -- Move (1, Max);
Max := Max - 1;
Sift (1);
......
......@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 2004-2007, Free Software Foundation, Inc. --
-- Copyright (C) 2004-2008, 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- --
......@@ -2077,14 +2077,10 @@ package body Ada.Containers.Vectors is
end if;
declare
EI : Element_Type renames Container.Elements.EA (I);
EJ : Element_Type renames Container.Elements.EA (J);
EI_Copy : constant Element_Type := EI;
EI_Copy : constant Element_Type := Container.Elements.EA (I);
begin
EI := EJ;
EJ := EI_Copy;
Container.Elements.EA (I) := Container.Elements.EA (J);
Container.Elements.EA (J) := EI_Copy;
end;
end Swap;
......
......@@ -6,14 +6,35 @@
-- --
-- S p e c --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. In accordance with the copyright of that document, you can freely --
-- copy and modify this specification, provided that if you redistribute a --
-- modified version, any changes that you have made are clearly indicated. --
-- Copyright (C) 2004-2008, 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- --
-- 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. --
-- --
-- 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. --
-- --
-- This unit was originally developed by Matthew J Heaney. --
------------------------------------------------------------------------------
function Ada.Strings.Equal_Case_Insensitive
(Left, Right : String) return Boolean;
pragma Pure (Ada.Strings.Equal_Case_Insensitive);
-- Performs a case-insensitive equality test of Left and Right. This is
-- useful as the generic actual equivalence operation (Equivalent_Keys)
-- when instantiating a hashed container package with type String as the
-- key. It is also useful as the generic actual equality operator when
-- instantiating a container package with type String as the element,
-- allowing case-insensitive container equality tests.
......@@ -6,16 +6,34 @@
-- --
-- S p e c --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. In accordance with the copyright of that document, you can freely --
-- copy and modify this specification, provided that if you redistribute a --
-- modified version, any changes that you have made are clearly indicated. --
-- Copyright (C) 2004-2008, 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- --
-- 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. --
-- --
-- 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. --
-- --
-- This unit was originally developed by Matthew J Heaney. --
------------------------------------------------------------------------------
with Ada.Containers;
function Ada.Strings.Hash_Case_Insensitive
(Key : String) return Containers.Hash_Type;
pragma Pure (Ada.Strings.Hash_Case_Insensitive);
-- Computes a hash value for Key without regard for character case. This is
-- useful as the generic actual Hash function when instantiating a hashed
-- container package with type String as the key.
......@@ -6,14 +6,33 @@
-- --
-- S p e c --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. In accordance with the copyright of that document, you can freely --
-- copy and modify this specification, provided that if you redistribute a --
-- modified version, any changes that you have made are clearly indicated. --
-- Copyright (C) 2004-2008, 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- --
-- 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. --
-- --
-- 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. --
-- --
-- This unit was originally developed by Matthew J Heaney. --
------------------------------------------------------------------------------
function Ada.Strings.Less_Case_Insensitive
(Left, Right : String) return Boolean;
pragma Pure (Ada.Strings.Less_Case_Insensitive);
-- Performs a case-insensitive lexicographic comparison of Left and
-- Right. This is useful as the generic actual less-than operator when
-- instantiating an ordered container package with type String as the key,
-- allowing case-insensitive equivalence tests.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment