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

⟦0b9dd8de1⟧ Ada Source

    Length: 5120 (0x1400)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Stack_Generic, seg_00eb07

Derivation

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

E3 Source Code



package body Stack_Generic is

    type Stack_Node is
        record
            Elt  : Element;
            Link : Stack;
        end record;

    procedure Make_Empty (S : in out Stack) is
    begin
        S := null;
    end Make_Empty;

    procedure Pop (S : in out Stack) is
    begin
        if S = null then
            raise Underflow;
        else
            S := S.Link;
        end if;
    end Pop;


    procedure Push (X : Element; S : in out Stack) is
        New_Node : Stack;
    begin
        New_Node := new Stack_Node'(Elt => X, Link => S);
        S        := New_Node;
    end Push;


    function Empty (S : Stack) return Boolean is
    begin
        return S = null;
    end Empty;


    function Top (S : Stack) return Element is
    begin
        if S = null then
            raise Underflow;
        else
            return S.Elt;
        end if;
    end Top;

    procedure Copy (Target : in out Stack; Source : Stack) is
        Rest_Of_Source : Stack;
        Last_Of_Target : Stack;
    begin
        if Source /= null then
            Target := new Stack_Node'(Elt => Source.Elt, Link => null);

            Last_Of_Target := Target;
            Rest_Of_Source := Source.Link;
            while Rest_Of_Source /= null loop
                Last_Of_Target.Link :=
                   new Stack_Node'(Elt => Rest_Of_Source.Elt, Link => null);
                Last_Of_Target      := Last_Of_Target.Link;
                Rest_Of_Source      := Rest_Of_Source.Link;
            end loop;
        else
            Target := null;
        end if;
    end Copy;

    procedure Init (Iter : out Iterator; S : Stack) is
    begin
        Iter := Iterator (S);
    end Init;

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

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

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

end Stack_Generic;

E3 Meta Data

    nblk1=4
    nid=0
    hdr6=8
        [0x00] rec0=30 rec1=00 rec2=01 rec3=042
        [0x01] rec0=00 rec1=00 rec2=04 rec3=010
        [0x02] rec0=20 rec1=00 rec2=02 rec3=018
        [0x03] rec0=09 rec1=00 rec2=03 rec3=001
    tail 0x2150ab1d2822542817191 0x42a00088462063203