|
|
DataMuseum.dkPresents historical artifacts from the history of: Rational R1000/400 |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Rational R1000/400 Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - download
Length: 8192 (0x2000)
Types: Ada Source
Notes: 03_class, FILE, R1k_Segment, e3_tag, package body String_Sort_Array, seg_03fe05
└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000
└─⟦cfc2e13cd⟧ »Space Info Vol 2«
└─⟦this⟧
package body String_Sort_Array is
type Element_Array is array (Element_Index range <>) of Element;
type Variable_Element_Array (Length : Element_Index := 0) is
record
Inner : Element_Array (1 .. Length);
end record;
The_Array : Variable_Element_Array;
Iterator_Index : Element_Index;
function Is_Empty return Boolean is
begin
return The_Array.Length = 0;
end Is_Empty;
function Index (Key : in String) return Element_Index is
Low, Mid, High : Element_Index;
Item_Found : Boolean := False;
Index : Element_Index := 0;
begin
if not Is_Empty then
Low := 1;
High := The_Array.Inner'Last;
while Low <= High and not Item_Found loop
Mid := (Low + High) / 2;
if Get_Key (The_Array.Inner (Mid)) < Key then
Low := Mid + 1;
elsif Get_Key (The_Array.Inner (Mid)) > Key then
High := Mid - 1;
else
Item_Found := True;
end if;
end loop;
if Item_Found then
Index := Mid;
end if;
end if;
return Index;
end Index;
procedure Put (Item : in Element; Found : out Boolean) is
Index : Element_Index := 1;
Temporary_Array : Element_Array (1 .. The_Array.Inner'Last + 1);
begin
if Is_Empty then
Found := False;
The_Array := (Length => 1, Inner => (others => Item));
else
while Index in The_Array.Inner'Range and then
Get_Key (The_Array.Inner (Index)) < Get_Key (Item) loop
Index := Index + 1;
end loop;
if Index not in The_Array.Inner'Range then
Found := False;
Temporary_Array := The_Array.Inner & Item;
The_Array := (Length => The_Array.Length + 1,
Inner => Temporary_Array);
elsif Get_Key (The_Array.Inner (Index)) /= Get_Key (Item) then
Found := False;
Temporary_Array := The_Array.Inner (1 .. Index - 1) & Item &
The_Array.Inner (Index ..
The_Array.Inner'Last);
The_Array := (Length => The_Array.Length + 1,
Inner => Temporary_Array);
else
Found := True;
end if;
end if;
end Put;
procedure Put (Item : in Element) is
Index : Element_Index := 1;
begin
if not Is_Empty then
while Index in The_Array.Inner'Range and then
Get_Key (The_Array.Inner (Index)) /= Get_Key (Item) loop
Index := Index + 1;
end loop;
if Index in The_Array.Inner'Range then
The_Array.Inner (Index) := Item;
end if;
end if;
end Put;
procedure Get (Key : String; Item : in out Element; Found : out Boolean) is
Low, Mid, High : Element_Index;
Item_Found : Boolean := False;
begin
if Is_Empty then
Found := False;
else
Low := 1;
High := The_Array.Inner'Last;
while Low <= High and not Item_Found loop
Mid := (Low + High) / 2;
if Get_Key (The_Array.Inner (Mid)) < Key then
Low := Mid + 1;
elsif Get_Key (The_Array.Inner (Mid)) > Key then
High := Mid - 1;
else
Item_Found := True;
end if;
end loop;
if Item_Found then
Found := True;
Item := The_Array.Inner (Mid);
else
Found := False;
end if;
end if;
end Get;
procedure Get (Key : Element_Index;
Item : in out Element;
Found : out Boolean) is
begin
if Key not in The_Array.Inner'Range then
Found := False;
else
Found := True;
Item := The_Array.Inner (Key);
end if;
end Get;
procedure Create_Iterator is
begin
Iterator_Index := 1;
end Create_Iterator;
function Iterator_Is_At_End return Boolean is
begin
if Is_Empty then
return True;
else
return Iterator_Index = The_Array.Length + 1;
end if;
end Iterator_Is_At_End;
function Item_Value return Element is
begin
return The_Array.Inner (Iterator_Index);
end Item_Value;
procedure Next_Item is
begin
Iterator_Index := Iterator_Index + 1;
end Next_Item;
end String_Sort_Array;
nblk1=7
nid=6
hdr6=c
[0x00] rec0=22 rec1=00 rec2=01 rec3=042
[0x01] rec0=1e rec1=00 rec2=02 rec3=056
[0x02] rec0=18 rec1=00 rec2=04 rec3=044
[0x03] rec0=12 rec1=00 rec2=05 rec3=04c
[0x04] rec0=21 rec1=00 rec2=03 rec3=00e
[0x05] rec0=1e rec1=00 rec2=07 rec3=000
[0x06] rec0=82 rec1=e0 rec2=00 rec3=031
tail 0x2173fe05a860c59798056 0x42a00088462060003
Free Block Chain:
0x6: 0000 00 00 01 90 80 13 65 72 20 28 49 6e 64 65 78 29 ┆ er (Index)┆