|
|
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 Constant_String_Bak, seg_011176
└─⟦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 Constant_String_Bak is
Number_Of_Conflict : Natural := 0;
Table_Width : constant Integer := 1027;
type Table_Of_Strings is array (Integer range 1 .. Table_Width) of Object;
Table : Table_Of_Strings;
------------------------------------------------------------
procedure Initialize is
begin
for I in Table'Range loop
Table (I) := Null_Object;
end loop;
end Initialize;
------------------------------------------------------------
function Hash_String2 (Str : String) return Integer is
S : Integer := 0;
Part : Integer;
Target : Integer;
begin
Part := Str'Length / 3;
Target := Part;
if Part = 0 then
for I in Str'Range loop
S := (S + Character'Pos (Str (I)));
end loop;
else
S := (S + Character'Pos (Str (1)));
for I in 1 .. 3 loo
S := (S + Character'Pos (Str (Target)));
Target := Target + Part;
end loop;
end if;
return S mod Table_Width + 1;
end Hash_String2;
------------------------------------------------------------
function Hash_String3 (Str : String) return Integer is
S : Integer := 0;
Part : Integer;
Target : Integer;
begin
Part := Str'Length / 3;
Target := Part;
if Part = 0 then
for I in Str'Range loop
S := (S + Character'Pos (Str (I)));
end loop;
else
S := Character'Pos (Str (1));
for I in 1 .. 3 loop
S := (S + Character'Pos (Str (Target)));
Target := Target + Part;
end loop;
end if;
return S + 1;
end Hash_String3;
------------------------------------------------------------
function Hash_String (Str : String) return Integer is
S : Integer := 0;
Part : Integer;
Target : Integer;
begin
for I in Str'Range loop
S := (S + Character'Pos (Str (I))) + 1;
end loop;
return (S mod Table_Width) + 1;
end Hash_String;
------------------------------------------------------------
procedure Insert (Ch : String; Place : Integer) is
A_Access_String : Object;
begin
A_Access_String := new String_Access'(Value => new String'(Ch),
Next => Table (Place));
Table (Place) := A_Access_String;
end Insert;
------------------------------------------------------------
function Is_Equal
(Ch : String; O : Constant_String.Object) return Boolean is
begin
return
Ch = O.Value.all;
end Is_Equal;
------------------------------------------------------------
function Value (S : String) return Constant_String.Object is
Place : Integer;
Finded : Boolean := False;
Object_Pointer : Object;
begin
Text_Io.Put_Line (" ");
Place := Hash_String (S);
-- Text_Io.Put_Line ("chaine : " & S & " ...place= " &
-- Integer'Image (Place));
Object_Pointer := Table (Place);
while not Finded and then Object_Pointer /= Null_Object loop
if Is_Equal (S, Object_Pointer) then
-- Text_Io.Put_Line ("chaine existe deja dans la table ");
Finded := True;
else
Object_Pointer := Object_Pointer.Next;
end if;
end loop;
if not Finded then
if Table (Place) /= Null_Object then
-- Text_Io.Put_Line (" il y a un conflit");
Number_Of_Conflict := Number_Of_Conflict + 1;
end if;
Insert (S, Place);
-- Text_Io.Put_Line ("la chaine est ajouitee dans la table");
end if;
return Table (Place);
end Value;
------------------------------------------------------------
function Conflicts_Number return Natural is
begin
return Number_Of_Conflict;
end Conflicts_Number;
------------------------------------------------------------
function Image (C : Constant_String.Object) return String is
begin
return C.Value.all;
end Image;
------------------------------------------------------------
begin
Initialize;
end Constant_String_Bak;
nblk1=7
nid=0
hdr6=e
[0x00] rec0=1f rec1=00 rec2=01 rec3=03e
[0x01] rec0=00 rec1=00 rec2=02 rec3=002
[0x02] rec0=1d rec1=00 rec2=07 rec3=032
[0x03] rec0=1b rec1=00 rec2=03 rec3=018
[0x04] rec0=00 rec1=00 rec2=05 rec3=008
[0x05] rec0=18 rec1=00 rec2=06 rec3=018
[0x06] rec0=14 rec1=00 rec2=04 rec3=001
tail 0x2150c850c823782393e7c 0x42a00088462060003