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

⟦d5406bf3c⟧ TextFile

    Length: 2277 (0x8e5)
    Types: TextFile
    Names: »B«

Derivation

└─⟦149519bd4⟧ Bits:30000546 8mm tape, Rational 1000, !projects 93-07-13
    └─ ⟦124ff5788⟧ »DATA« 
        └─⟦this⟧ 
└─⟦a7d1ea751⟧ Bits:30000550 8mm tape, Rational 1000, !users!projects 94_04_11
    └─ ⟦129cab021⟧ »DATA« 
        └─⟦this⟧ 
└─⟦f64eaa120⟧ Bits:30000752 8mm tape, Rational 1000, !projects 93 02 16
    └─ ⟦6f12a12be⟧ »DATA« 
        └─⟦this⟧ 
└─⟦2f6cfab89⟧ Bits:30000547 8mm tape, Rational 1000, !projects 94-01-04
    └─ ⟦d65440be7⟧ »DATA« 
        └─⟦this⟧ 

TextFile

with Unchecked_Deallocation;
package body Set_Generic is

    procedure Free is new Unchecked_Deallocation (Object => Node, Name => Set);

    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
        First : Set := S;
    begin
        if S /= null then
            Make_Empty (First.Link);
        end if;
        Free (S);
    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;
                Free (Current);
                return;
            end if;
            Previous := Current;
            Current := Current.Link;
        end loop;
    end Delete;

end Set_Generic;