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

⟦192615c32⟧ Ada Source

    Length: 9216 (0x2400)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, generic, package Binary_Trees, seg_044be4, seg_044c3b, seg_044fde, seg_04528d

Derivation

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

E3 Source Code



generic
    type Value_Type is private;

    with function Difference (P, Q : Value_Type) return Integer is <>;

package Binary_Trees is


----------------------------------------------------------------------------
    -- Exceptions --
----------------------------------------------------------------------------

    Duplicate_Value : exception;

    Not_Found : exception;

    No_More : exception;

    Out_Of_Order : exception;

    Invalid_Tree : exception;

    No_More_Element : exception;
    --| raised if there is no more element in a tree by the fonction S_&_D;

----------------------------------------------------------------------------
    -- Types --
----------------------------------------------------------------------------

    type Scan_Kind is (Inorder, Preorder, Postorder);

    type Tree is private;
    type Iterator is private;

----------------------------------------------------------------------------
    -- Operations --
----------------------------------------------------------------------------

    function Create return Tree;


----------------------------------------------------------------------------

    procedure Insert (V : Value_Type; T : Tree);

----------------------------------------------------------------------------

    procedure Insert_If_Not_Found (V : Value_Type;
                                   T : Tree;
                                   Found : out Boolean;
                                   Duplicate : out Value_Type);


----------------------------------------------------------------------------

    procedure Replace_If_Found (V : Value_Type;
                                T : Tree;
                                Found : out Boolean;
                                Old_Value : out Value_Type);

----------------------------------------------------------------------------

    procedure Destroy (T : in out Tree);

----------------------------------------------------------------------------

    generic
        with procedure Free_Value (V : in out Value_Type) is <>;

    procedure Destroy_Deep (T : in out Tree);
---------------------------------------------------------------------------

    generic
        with function Next_Value return Value_Type is <>;

    function Balanced_Tree (Count : Natural) return Tree;

----------------------------------------------------------------------------

    generic
        with function Copy_Value (V : Value_Type) return Value_Type is <>;

    function Copy_Tree (T : Tree) return Tree;

----------------------------------------------------------------------------

    function Is_Empty (T : Tree) return Boolean;

----------------------------------------------------------------------------

    function Find (V : Value_Type; T : Tree) return Value_Type;


    procedure Find (V : Value_Type;
                    T : Tree;                   Found : out Boolean;
                    Match : out Value_Type);

----------------------------------------------------------------------------

    function Is_Found (V : Value_Type; T : Tree) return Boolean;

----------------------------------------------------------------------------

    function Size (T : Tree) return Natural;

----------------------------------------------------------------------------

    generic
        with procedure Process (V : Value_Type) is <>;

    procedure Visit (T : Tree; Order : Scan_Kind := Inorder);

----------------------------------------------------------------------------

    function Make_Iter (T : Tree) return Iterator;

    procedure Make_Iterator (T : Tree;
                             An_Iterator : in out Iterator;
                             A_Value : out Value_Type);

----------------------------------------------------------------------------

    function More (I : Iterator) return Boolean;

----------------------------------------------------------------------------

    procedure First (I : in out Iterator; V : out Value_Type);

    procedure Next (I : in out Iterator; V : out Value_Type);

----------------------------------------------------------------------------

    procedure Search_And_Delete
                 (
                  --| Search in a tree a value and delete it from the tree after return it if exists;
                  T : in out Tree;
                  Element : out Value_Type);
----------------------------------------------------------------------------

private

    type Node;
    type Node_Ptr is access Node;

    type Node is
        record
            Value : Value_Type;
            Less : Node_Ptr;
            More : Node_Ptr;
        end record;

    type Tree_Header is
        record
            Count : Natural := 0;
            Root : Node_Ptr := null;
            Courant : Node_Ptr := null;
        end record;

    type Tree is access Tree_Header;

    type Iter_State is (Left, Middle, Right, Done);

    type Iterator_Record;
    type Iterator is access Iterator_Record;

    type Iterator_Record is
        record
            State : Iter_State;
            Parent : Iterator;
            Subtree : Node_Ptr;
        end record;


end Binary_Trees;

E3 Meta Data

    nblk1=8
    nid=7
    hdr6=e
        [0x00] rec0=25 rec1=00 rec2=01 rec3=012
        [0x01] rec0=1d rec1=00 rec2=06 rec3=00e
        [0x02] rec0=1f rec1=00 rec2=05 rec3=002
        [0x03] rec0=1c rec1=00 rec2=04 rec3=044
        [0x04] rec0=06 rec1=00 rec2=02 rec3=07a
        [0x05] rec0=25 rec1=00 rec2=08 rec3=026
        [0x06] rec0=0a rec1=00 rec2=03 rec3=000
        [0x07] rec0=68 rec1=63 rec2=06 rec3=02b
    tail 0x21540cc8886434af3afd2 0x42a00088462060003
Free Block Chain:
  0x7: 0000  00 00 00 0c 80 03 65 73 3b 03 00 00 00 00 00 00  ┆      es;       ┆