|
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 - download
Length: 8192 (0x2000) Types: Ada Source Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Table, seg_04f52e
└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000 └─ ⟦5a81ac88f⟧ »Space Info Vol 1« └─⟦this⟧
with Text_Io; package body Table is Eol : constant Natural := 0; procedure Initialise (O : in out Object) is begin for I in O.Hashing'Range loop O.Hashing (I) := Eol; end loop; O.Liste_Poste_Libre := Tab_Item'First; for I in Tab_Item'First .. Tab_Item'Last - 1 loop O.Tableau (I).Suivant := I + 1; end loop; O.Tableau (O.Tableau'Last).Suivant := Eol; end Initialise; function Hash (N : Natural) return Natural is begin return (N mod Max_Taille_Hash) + 1; end Hash; procedure Get_Premier_Libre (O : in out Object; N : in out Natural) is begin if O.Liste_Poste_Libre = Eol then raise Overflow_Error; else N := O.Liste_Poste_Libre; O.Liste_Poste_Libre := O.Tableau (N).Suivant; end if; end Get_Premier_Libre; procedure Set_Premier_Libre (O : in out Object; N : Natural) is begin O.Tableau (N).Suivant := O.Liste_Poste_Libre; O.Liste_Poste_Libre := N; end Set_Premier_Libre; procedure Add_Item (O : in out Object; I : Item) is N : Natural; H : Natural; begin Get_Premier_Libre (O, N); O.Tableau (N).Element := I; H := Hash (Cle (I)); O.Tableau (N).Suivant := O.Hashing (H); O.Hashing (H) := N; end Add_Item; procedure Rem_Item (O : in out Object; I : Item) is H : Natural; N : Natural; Prec : Natural; begin H := Hash (Cle (I)); N := O.Hashing (H); if N = Eol then raise Not_Found_Error; else if O.Tableau (N).Element = I then O.Hashing (H) := O.Tableau (N).Suivant; Set_Premier_Libre (O, N); else Prec := N; N := O.Tableau (N).Suivant; while N /= Eol loop if O.Tableau (N).Element = I then O.Tableau (Prec).Suivant := O.Tableau (N).Suivant; Set_Premier_Libre (O, N); exit; end if; Prec := N; N := O.Tableau (N).Suivant; end loop; if N = Eol then raise Not_Found_Error; end if; end if; end if; end Rem_Item; procedure Mod_Item (O : in out Object; I, Par : Item) is begin Rem_Item (O, I); Add_Item (O, Par); end Mod_Item; procedure Dump (O : Object) is N : Natural; begin N := O.Liste_Poste_Libre; Text_Io.Put ("postes libres : ->"); while N /= Eol loop Text_Io.Put (Natural'Image (N) & "->"); N := O.Tableau (N).Suivant; end loop; Text_Io.New_Line; for I in Tab_Hash'Range loop Text_Io.Put ("hash(" & Natural'Image (I) & ") ->"); N := O.Hashing (I); while N /= Eol loop Text_Io.Put (Image (O.Tableau (N).Element) & "->"); N := O.Tableau (N).Suivant; end loop; Text_Io.New_Line; end loop; end Dump; function First_Item (O : in Object) return Iterateur is Iter : Iterateur; begin Iter.Utilise_Cle := False; Iter.Hash := 1; Iter.Indice := Eol; while Iter.Hash /= Max_Taille_Hash loop if O.Hashing (Iter.Hash) /= Eol then exit; end if; Iter.Hash := Iter.Hash + 1; end loop; Iter.Indice := O.Hashing (Iter.Hash); return Iter; end First_Item; function First_Item (O : Object; Key : Natural) return Iterateur is Iter : Iterateur; begin Iter.Utilise_Cle := True; Iter.Cle := Key; Iter.Indice := O.Hashing (Hash (Key)); while Iter.Indice /= Eol loop if Cle (O.Tableau (Iter.Indice).Element) = Iter.Cle then exit; end if; Iter.Indice := O.Tableau (Iter.Indice).Suivant; end loop; return Iter; end First_Item; procedure Next_Item (Iter : in out Iterateur; O : Object) is begin if End_Of_Iter (Iter) then raise Iterateur_Error; else if Iter.Utilise_Cle then Iter.Indice := O.Tableau (Iter.Indice).Suivant; while Iter.Indice /= Eol loop if Cle (O.Tableau (Iter.Indice).Element) = Iter.Cle then exit; else Iter.Indice := O.Tableau (Iter.Indice).Suivant; end if; end loop; else Iter.Indice := O.Tableau (Iter.Indice).Suivant; if Iter.Indice = Eol then if Iter.Hash /= Max_Taille_Hash then Iter.Hash := Iter.Hash + 1; while Iter.Hash /= Max_Taille_Hash loop if O.Hashing (Iter.Hash) /= Eol then exit; end if; Iter.Hash := Iter.Hash + 1; end loop; Iter.Indice := O.Hashing (Iter.Hash); end if; end if; end if; end if; end Next_Item; function Current_Item (Iter : Iterateur; O : Object) return Item is begin if End_Of_Iter (Iter) then raise Iterateur_Error; else return O.Tableau (Iter.Indice).Element; end if; end Current_Item; function End_Of_Iter (Iter : Iterateur) return Boolean is begin if Iter.Utilise_Cle then return (Iter.Indice = Eol); else return (Iter.Indice = Eol) and (Iter.Hash >= Max_Taille_Hash); end if; end End_Of_Iter; function Is_Full (O : Object) return Boolean is begin return (O.Liste_Poste_Libre = Eol); end Is_Full; function Is_In (O : Object; I : Item) return Boolean is P : Natural; Key : Natural := Cle (I); begin P := O.Hashing (Hash (Key)); while P /= Eol loop if Key = Cle (O.Tableau (P).Element) then if O.Tableau (P).Element = I then return True; end if; end if; P := O.Tableau (P).Suivant; end loop; return False; end Is_In; end Table;
nblk1=7 nid=0 hdr6=e [0x00] rec0=27 rec1=00 rec2=01 rec3=050 [0x01] rec0=20 rec1=00 rec2=07 rec3=04c [0x02] rec0=1f rec1=00 rec2=06 rec3=00e [0x03] rec0=1e rec1=00 rec2=05 rec3=01c [0x04] rec0=1b rec1=00 rec2=04 rec3=02e [0x05] rec0=1c rec1=00 rec2=03 rec3=00a [0x06] rec0=22 rec1=00 rec2=02 rec3=001 tail 0x2154a859687777579e3fc 0x42a00088462060003