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

⟦6ea8cc4ea⟧ TextFile

    Length: 2031 (0x7ef)
    Types: TextFile
    Names: »B«

Derivation

└─⟦5829e5ed5⟧ Bits:30000534 8mm tape, Rational 1000, RCI 2_0_5
    └─ ⟦c9a165082⟧ »DATA« 
        └─⟦2162db02b⟧ 
            └─⟦this⟧ 

TextFile

package body Set_Generic is

    procedure Initialize (S : out Set) is
    begin
        S := null;
    end Initialize;

    function Is_Empty (S : Set) return Boolean is
    begin
        return S = null;
    end Is_Empty;

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

    procedure Init (Iter : out Iterator; S : Set) 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.Value;
    end Value;

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

    procedure Copy (Target : in out Set; Source : Set) is
        Rest : Set := Source;
    begin
        Target := null;
        while Rest /= null loop
            Target := new Node'(Rest.Value, Target);
            Rest := Rest.Link;
        end loop;
    end Copy;


    function Is_Member (S : Set; X : Element) return Boolean is
        Rest : Set := S;
    begin
        while Rest /= null loop
            if Rest.Value = X then
                return True;
            end if;
            Rest := Rest.Link;
        end loop;
        return False;
    end Is_Member;

    procedure Add (S : in out Set; X : Element) is
    begin
        if not Is_Member (S, X) then
            S := new Node'(X, S);
        end if;
    end Add;

    procedure Delete (S : in out Set; X : Element) is
        Current : Set := S;
        Previous : Set := null;
    begin
        while Current /= null loop
            if Current.Value = X then
                if Previous /= null then
                    Previous.Link := Current.Link;
                else
                    S := Current.Link;
                end if;
                return;
            end if;
            Previous := Current;
            Current := Current.Link;
        end loop;
    end Delete;

end Set_Generic;