|
|
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: 10240 (0x2800)
Types: Ada Source
Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Table1, seg_04eb56
└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000
└─⟦5a81ac88f⟧ »Space Info Vol 1«
└─⟦this⟧
with Io;
package body Table1 is
procedure Create (O : in out Object) is
begin
O.Premier := Fin_Liste;
O.Libre := O.Tab'First;
for I in O.Tab'First .. O.Tab'Last - 1 loop
O.Tab (I).Suiv := I + 1;
end loop;
O.Tab (O.Tab'Last).Suiv := Fin_Liste;
end Create;
procedure Ajouter (O : in out Object; Element : Item) is
Indice, Prec : Natural;
Key : Natural;
begin
if O.Libre = Fin_Liste then
raise Table_Overflow;
else
if O.Premier = Fin_Liste then
Indice := O.Libre;
O.Libre := O.Tab (Indice).Suiv;
O.Premier := Indice;
O.Tab (Indice).Element := Element;
O.Tab (Indice).Suiv := Fin_Liste;
else
Key := Cle (Element);
if Key < Cle (O.Tab (O.Premier).Element) then
Idice := O.Libre;
O.Libre := O.Tab (Indice).Suiv;
O.Tab (Indice).Suiv := O.Premier;
O.Tab (Indice).Element := Element;
O.Premier := Indice;
else
Prec := O.Premier;
Indice := O.Tab (O.Premier).Suiv;
while Indice /= Fin_Liste loop
if Cle (O.Tab (Indice).Element) > Key then
exit;
end if;
Prec := Indice;
Indice := O.Tab (Indice).Suiv;
end loop;
Indice := O.Libre;
O.Libre := O.Tab (Indice).Suiv;
O.Tab (Indice).Suiv := O.Tab (Prec).Suiv;
O.Tab (Indice).Element := Element;
O.Tab (Prec).Suiv := Indice;
end if;
end if;
end if;
end Ajouter;
procedure Supprimer (O : in out Object; Key : Natural) is
Indice, Prec : Natural;
begin
Indice := O.Premier;
if Indice /= Fin_Liste then
if Cle (O.Tab (Indice).Element) = Key then
O.Premier := O.Tab (Indice).Suiv;
O.Tab (Indice).Suiv := O.Libre;
O.Libre := Indice;
else
Prec := Indice;
Indice := O.Tab (Indice).Suiv;
while Indice /= Fin_Liste loop
if Cle (O.Tab (Indice).Element) = Key then
O.Tab (Prec).Suiv := O.Tab (Indice).Suiv;
O.Tab (Indice).Suiv := O.Libre;
O.Libre := Indice;
exit;
end if;
Prec := Indice;
Indice := O.Tab (Indice).Suiv;
end loop;
if Indice = Fin_Liste then
raise Item_Not_Found;
end if;
end if;
end if;
end Supprimer;
procedure Modifier (O : in out Object; Key : Natural; Element : Item) is
begin
Supprimer (O, Key);
Ajouter (O, Element);
end Modifier;
function Position (O : Object; Key : Natural; A_Partir_De : Natural)
return Natural is
Indice : Natural;
Current_Key : Natural;
begin
Indice := A_Partir_De;
while Indice /= Fin_Liste loop
Current_Key := Cle (O.Tab (Indice).Element);
if Current_Key = Key then
return Indice;
elsif Current_Key > Key then
return Fin_Liste;
end if;
end loop;
return Fin_Liste;
end Position;
function Is_In (O : Object; Key : Natural) return Boolean is
begin
return (Position (O => O, Key => Key, A_Partir_De => O.Premier) /=
Fin_Liste);
end Is_In;
function Search (O : Object; Key : Natural) return Item is
Indice : Natural;
begin
Indice := Position (O => O, Key => Key, A_Partir_De => O.Premier);
if Indice = Fin_Liste then
raise Item_Not_Found;
else
return O.Tab (Indice).Element;
end if;
end Search;
function First_Item (O : Object; Key : Natural) return Iterateur is
Indice : Natural;
Iter : Iterateur;
begin
Indice := Position (O => O, Key => Key, A_Partir_De => O.Premier);
Iter.Indice := Indice;
Iter.Cle := Key;
Iter.Utilise_Cle := True;
return Iter;
end First_Item;
function First_Item (O : Object) return Iterateur is
Iter : Iterateur;
begin
Iter.Indice := O.Premier;
Iter.Utilise_Cle := False;
return Iter;
end First_Item;
function Current_Item (I : Iterateur; O : Object) return Item is
begin
if I.Indice = Fin_Liste then
raise Fin_Iterateur;
else
return O.Tab (I.Indice).Element;
end if;
end Current_Item;
procedure Next_Item (I : in out Iterateur; O : Object) is
begin
if I.Indice = Fin_Liste then
raise Fin_Iterateur;
else
if I.Utilise_Cle then
I.Indice := Position
(O => O, Key => I.Cle, A_Partir_De => I.Indice);
else
I.Indice := O.Tab (I.Indice).Suiv;
end if;
end if;
end Next_Item;
function End_Item (I : Iterateur) return Boolean is
begin
return I.Indice = Fin_Liste;
end End_Item;
procedure Dump (O : Object) is
Iter : Iterateur;
begin
Iter := First_Item (O);
while not End_Item (Iter) loop
Io.Put_Line (Image (Current_Item (Iter, O)));
Next_Item (Iter, O);
end loop;
end Dump;
end Table1;
nblk1=9
nid=9
hdr6=10
[0x00] rec0=26 rec1=00 rec2=01 rec3=02a
[0x01] rec0=00 rec1=00 rec2=07 rec3=002
[0x02] rec0=1d rec1=00 rec2=08 rec3=012
[0x03] rec0=1a rec1=00 rec2=04 rec3=048
[0x04] rec0=21 rec1=00 rec2=03 rec3=058
[0x05] rec0=22 rec1=00 rec2=06 rec3=01c
[0x06] rec0=25 rec1=00 rec2=05 rec3=03c
[0x07] rec0=07 rec1=00 rec2=02 rec3=000
[0x08] rec0=14 rec1=f5 rec2=00 rec3=006
tail 0x2154a36ea8770673b4e3b 0x42a00088462060003
Free Block Chain:
0x9: 0000 00 00 00 04 80 01 65 01 02 03 04 40 00 00 7f 78 ┆ e @ x┆