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

⟦8076093ab⟧ Ada Source

    Length: 3072 (0xc00)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Queue_Generic, seg_00ea0b

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 Queue_Generic is

    procedure Initialize (Q : out Queue) is
    begin
        null;
    end Initialize;

    function Is_Empty (Q : Queue) return Boolean is
    begin
        return Q.Head = null;
    end Is_Empty;

    procedure Make_Empty (Q : in out Queue) is
    begin
        Q.Head := null;
        Q.Tail := null;
    end Make_Empty;

    procedure Init (Iter : out Iterator; Q : Queue) is
    begin
        Iter := Iterator (Q);
    end Init;

    procedure Next (Iter : in out Iterator) is
    begin
        Iter.Head := Iter.Head.Link;
    end Next;

    function Value (Iter : Iterator) return Element is
    begin
        return Iter.Head.Value;
    end Value;

    function Done (Iter : Iterator) return Boolean is
    begin
        return Iter.Head = null;
    end Done;

    procedure Copy (Target : in out Queue; Source : Queue) is
        Iter : Iterator;
    begin
        Make_Empty (Target);
        Init (Iter, Source);
        while not Done (Iter) loop
            Add (Target, Value (Iter));
            Next (Iter);
        end loop;
    end Copy;

    procedure Add (Q : in out Queue; X : Element) is
        New_Node : constant Pointer := new Node'(X, null);
    begin
        if Q.Head = null then
            Q.Head := New_Node;
        else
            Q.Tail.Link := New_Node;
        end if;
        Q.Tail := New_Node;
    end Add;

    procedure Delete (Q : in out Queue) is
        First : constant Pointer := Q.Head;
    begin
        Q.Head     := First.Link;
        First.Link := null;
        if Q.Head = null then
            Q.Tail := null;
        end if;
    end Delete;

    function First (Q : Queue) return Element is
    begin
        return Q.Head.Value;
    end First;

end Queue_Generic;

E3 Meta Data

    nblk1=2
    nid=0
    hdr6=4
        [0x00] rec0=2c rec1=00 rec2=01 rec3=006
        [0x01] rec0=22 rec1=00 rec2=02 rec3=000
    tail 0x2170b4f6a82253d877a98 0x42a00088462063203