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

⟦032a77c02⟧ Ada Source

    Length: 6144 (0x1800)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Trees, seg_03030f

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 Trees is
    type Node is
        record
            The_Element : Element;
            Left_Subtree, Right_Subtree : Object;
        end record;

    procedure Copy (From_Tree : in Object; To_Tree : in out Object) is
    begin
        if From_Tree = null then
            To_Tree := null;
        else
            To_Tree := new Node'(The_Element => From_Tree.The_Element,
                                 Left_Subtree => null,
                                 Right_Subtree => null);
            Copy (From_Tree.Left_Subtree, To_Tree.Left_Subtree);
            Copy (From_Tree.Right_Subtree, To_Tree.Right_Subtree);
        end if;  
    exception
        when Storage_Error =>
            raise Overfull;
    end Copy;


    procedure Purge (The_Tree : in out Object) is
    begin
        The_Tree := null;
    end Purge;


    procedure Build (The_Element : Element;
                     The_Tree : in out Object;
                     Of_The_Son : Son) is
    begin
        if Of_The_Son = Left then
            The_Tree := new Node'(The_Element => The_Element,
                                  Left_Subtree => The_Tree,
                                  Right_Subtree => null);
        else
            The_Tree := new Node'(The_Element => The_Element,
                                  Left_Subtree => null,
                                  Right_Subtree => The_Tree);
        end if;  
    exception
        when Storage_Error =>
            raise Overfull;  
    end Build;


    procedure Put (From_Tree : in out Object; To_Element : Element) is
    begin
        From_Tree.The_Element := To_Element;
    exception
        when Storage_Error =>
            raise Tree_Is_Empty;
    end Put;


    procedure Swap (The_Son : Son;
                    From_Tree : in out Object;
                    With_Tree : in out Object) is
        Temporary_Node : Object;
    begin
        if The_Son = Left then
            Temporary_Node := From_Tree.Left_Subtree;
            From_Tree.Left_Subtree := With_Tree;
        else
            Temporary_Node := From_Tree.Right_Subtree;
            From_Tree.Right_Subtree := With_Tree;
        end if;
        With_Tree := Temporary_Node;
    exception
        when Storage_Error =>
            raise Tree_Is_Empty;
    end Swap;


    function Is_Equal (Left, Right : Object) return Boolean is
    begin
        if Left = null and Right = null then
            return True;
        elsif Left = null or Right = null then
            return False;
        else
            return  
               Left.The_Element = Right.The_Element and then
                  Is_Equal (Left.Left_Subtree, Right.Left_Subtree) and then
                  Is_Equal (Left.Right_Subtree, Right.Right_Subtree);
        end if;
    end Is_Equal;


    function Is_Empty (The_Tree : Object) return Boolean is
    begin
        return (The_Tree = null);
    end Is_Empty;


    function Element_From (The_Tree : Object) return Element is  
    begin
        return The_Tree.The_Element;
    exception
        when Constraint_Error =>
            raise Tree_Is_Empty;
    end Element_From;


    function Son_Of (The_Tree : Object; The_Son : Son) return Object is
    begin
        if The_Son = Left then
            return The_Tree.Left_Subtree;
        else
            return The_Tree.Right_Subtree;
        end if;
    exception
        when Constraint_Error =>
            raise Tree_Is_Empty;
    end Son_Of;

end Trees;

E3 Meta Data

    nblk1=5
    nid=4
    hdr6=8
        [0x00] rec0=22 rec1=00 rec2=01 rec3=026
        [0x01] rec0=1f rec1=00 rec2=02 rec3=01a
        [0x02] rec0=1f rec1=00 rec2=03 rec3=00e
        [0x03] rec0=1a rec1=00 rec2=05 rec3=000
        [0x04] rec0=c0 rec1=00 rec2=00 rec3=100
    tail 0x217298b5e849a60f3f93a 0x42a00088462060003
Free Block Chain:
  0x4: 0000  00 00 02 1f 80 13 72 65 74 75 72 6e 20 45 6c 65  ┆      return Ele┆