DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400

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

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download

⟦01b37c1f3⟧ Ada Source

    Length: 6144 (0x1800)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Constant_String, package body Operators, seg_04a302, seg_04a9d5, seg_04b441

Derivation

└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000
    └─ ⟦cfc2e13cd⟧ »Space Info Vol 2« 
        └─⟦this⟧ 

E3 Source Code



package body Constant_String is
    type Node;
    type Access_Node is access Node;

    type Node is  -- a binary search tree
        record
            The_String  : Object;
            Left, Right : Access_Node;
        end record;

    The_Root : Access_Node;

    procedure Make (From_Tree  : in out Access_Node;
                    For_String :        String;
                    The_Result : out    Object) is  
        The_String : Object;
    begin
        if From_Tree = null then  
            The_String := new String'(For_String);
            From_Tree  := new Node'(The_String, null, null);
            The_Result := The_String;
        elsif For_String < From_Tree.The_String.all then
            Make (From_Tree.Left, For_String, The_Result);
        elsif For_String /= From_Tree.The_String.all then
            Make (From_Tree.Right, For_String, The_Result);
        else
            The_Result := From_Tree.The_String;
        end if;
    end Make;


    function Value (For_String : String) return Object is  
        Result : Object;
    begin
        Make (The_Root, For_String, Result);  
        return Result;
    end Value;

    function Image (Of_Object : Object) return String is
    begin
        return Of_Object.all;
    end Image;

    procedure Put (The_Object : Object; Where : Output_Stream.Object) is
        use Output_Stream;
    begin
        Put (Image (The_Object), Where);
    end Put;

    procedure Put (At_Index   : Positive;
                   The_String : Object;
                   Where      : Output_Stream.Object) is  
        use Output_Stream;
    begin
        if At_Index /= 1 then
            Put_Line (',', Where);
        end if;
        Put (At_Index, Where);
        Put (" => ", Where);
        Put ('"' & The_String.all & '"', Where);
    end Put;


    procedure Put (The_Tree : Access_Node; Where : Output_Stream.Object) is
        Index : Positive := 1;
        procedure R_Put (The_Tree : Access_Node;
                         Where    : Output_Stream.Object) is
            use Output_Stream;
        begin
            if The_Tree /= null then
                R_Put (The_Tree.Left, Where);
                Put (Index, The_Tree.The_String, Where);
                Index := Index + 1;
                R_Put (The_Tree.Right, Where);
            end if;
        end R_Put;
    begin
        Output_Stream.Put_Line ("Constant_String_Set'(", Where);
        Output_Stream.Indent (+2, Where);  
        R_Put (The_Tree, Where);
        Output_Stream.Indent (-2, Where);
        Output_Stream.Put_Line (")", Where);
    end Put;

    procedure Put (Where : Output_Stream.Object) is
    begin
        Put (The_Tree => The_Root, Where => Where);
    end Put;

    package body Operators is
        function "<" (Left, Right : Object) return Boolean is
        begin
            return Left.all < Right.all;
        end "<";


        function "<=" (Left, Right : Object) return Boolean is
        begin
            return Left.all <= Right.all;
        end "<=";


        function ">" (Left, Right : Object) return Boolean is
        begin
            return Left.all > Right.all;
        end ">";


        function ">=" (Left, Right : Object) return Boolean is
        begin
            return Left.all >= Right.all;
        end ">=";
    end Operators;
end Constant_String;

E3 Meta Data

    nblk1=5
    nid=0
    hdr6=a
        [0x00] rec0=1e rec1=00 rec2=01 rec3=008
        [0x01] rec0=00 rec1=00 rec2=05 rec3=004
        [0x02] rec0=24 rec1=00 rec2=02 rec3=022
        [0x03] rec0=1c rec1=00 rec2=03 rec3=050
        [0x04] rec0=16 rec1=00 rec2=04 rec3=000
    tail 0x2174ea068866e7c11a757 0x42a00088462063c03