DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400 Tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about Rational R1000/400 Tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download
Index: ┃ B T

⟦9ad10cb3f⟧ TextFile

    Length: 3887 (0xf2f)
    Types: TextFile
    Names: »B«

Derivation

└─⟦149519bd4⟧ Bits:30000546 8mm tape, Rational 1000, !projects 93-07-13
    └─ ⟦124ff5788⟧ »DATA« 
        └─⟦this⟧ 
└─⟦a7d1ea751⟧ Bits:30000550 8mm tape, Rational 1000, !users!projects 94_04_11
    └─ ⟦129cab021⟧ »DATA« 
        └─⟦this⟧ 
└─⟦f64eaa120⟧ Bits:30000752 8mm tape, Rational 1000, !projects 93 02 16
    └─ ⟦6f12a12be⟧ »DATA« 
        └─⟦this⟧ 
└─⟦2f6cfab89⟧ Bits:30000547 8mm tape, Rational 1000, !projects 94-01-04
    └─ ⟦d65440be7⟧ »DATA« 
        └─⟦this⟧ 

TextFile

with Text_Io;
package body Constant_String is
    Number_Of_Conflict : Natural := 0;
    Max_Size : constant Integer := 517;
    type Table_Of_Strings is array (Integer range 1 .. Max_Size) 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_String (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 loop
                S := (S + Character'Pos (Str (Target)));
                Target := Target + Part;
            end loop;
        end if;
        return S mod Max_Size + 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  
        Place := Hash_String (S);
        Object_Pointer := Table (Place);
        while not Finded and then Object_Pointer /= Null_Object loop
            if S = Object_Pointer.Value.all then
                Finded := True;
            else
                Object_Pointer := Object_Pointer.Next;
            end if;
        end loop;
        if not Finded then
            Insert (S, Place);
        end if;
        return Table (Place);
    end Value;
    ------------------------------------------------------------
    function Image (C : Constant_String.Object) return String is
    begin
        return C.Value.all;
    exception
        when others =>
            raise Access_Error;
    end Image;
    ------------------------------------------------------------
    package body Operators is

        function "<" (Left, Right : Constant_String.Object) return Boolean is
        begin
            return Left.Value.all < Right.Value.all;
        exception
            when others =>
                raise Access_Error;
        end "<";

        function ">" (Left, Right : Constant_String.Object) return Boolean is
        begin
            return Left.Value.all > Right.Value.all;
        exception
            when others =>
                raise Access_Error;
        end ">";

        function "<=" (Left, Right : Constant_String.Object) return Boolean is
        begin
            return Left.Value.all <= Right.Value.all;
        exception
            when others =>
                raise Access_Error;
        end "<=";

        function ">=" (Left, Right : Constant_String.Object) return Boolean is
        begin
            return Left.Value.all >= Right.Value.all;
        exception
            when others =>
                raise Access_Error;
        end ">=";

    end Operators;
    ------------------------------------------------------------
begin
    Initialize;
end Constant_String;