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

⟦7fac59edb⟧ TextFile

    Length: 3334 (0xd06)
    Types: TextFile
    Names: »B«

Derivation

└─⟦a7d1ea751⟧ Bits:30000550 8mm tape, Rational 1000, !users!projects 94_04_11
    └─ ⟦129cab021⟧ »DATA« 
        └─⟦this⟧ 
└─⟦2f6cfab89⟧ Bits:30000547 8mm tape, Rational 1000, !projects 94-01-04
    └─ ⟦d65440be7⟧ »DATA« 
        └─⟦this⟧ 
└─⟦a7d1ea751⟧ Bits:30000550 8mm tape, Rational 1000, !users!projects 94_04_11
    └─ ⟦129cab021⟧ »DATA« 
        └─⟦e24fb53b7⟧ 
            └─⟦this⟧ 

TextFile

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;