OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gnat.dg/] [sort1.adb] - Blame information for rev 304

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 304 jeremybenn
with GNAT.Heap_Sort_G;
2
function sort1 (S : String) return String is
3
   Result : String (1 .. S'Length) := S;
4
   Temp : Character;
5
 
6
   procedure Move (From : Natural; To : Natural) is
7
   begin
8
      if From = 0 then Result (To) := Temp;
9
      elsif To = 0 then Temp := Result (From);
10
      else Result (To) := Result (From);
11
              end if;
12
   end Move;
13
 
14
   function Lt (Op1, Op2 : Natural) return Boolean is
15
   begin
16
      if Op1 = 0 then return Temp < Result (Op2);
17
      elsif Op2 = 0 then return Result (Op1) < Temp;
18
      else return Result (Op1) < Result (Op2);
19
      end if;
20
   end Lt;
21
 
22
   package SP is new GNAT.Heap_Sort_G (Move, Lt);
23
 
24
begin
25
   SP.Sort (S'Length);
26
   return Result;
27
end;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.