blob: cf0fb5d5fac8f9bbbf5355583a5ef4884c4fea64 [file] [log] [blame]
with GNAT.Heap_Sort_G;
function sort1 (S : String) return String is
Result : String (1 .. S'Length) := S;
Temp : Character;
procedure Move (From : Natural; To : Natural) is
if From = 0 then Result (To) := Temp;
elsif To = 0 then Temp := Result (From);
else Result (To) := Result (From);
end if;
end Move;
function Lt (Op1, Op2 : Natural) return Boolean is
if Op1 = 0 then return Temp < Result (Op2);
elsif Op2 = 0 then return Result (Op1) < Temp;
else return Result (Op1) < Result (Op2);
end if;
end Lt;
package SP is new GNAT.Heap_Sort_G (Move, Lt);
SP.Sort (S'Length);
return Result;