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

⟦1f8af2340⟧ Ada Source

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

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

    One : constant Long_Integer := 1;


    procedure Init_Holes (Holes : out Hole_List; Lo, Hi : Long_Integer) is
    begin
        Holes := new Hole_Descriptor'(Lo => Lo, Hi => Hi, Next => null);
    end Init_Holes;

    procedure Delete_Hole (Holes   : in out Hole_List;
                           Lo, Hi  :        Long_Integer;
                           Success : out    Boolean) is
        H    : Hole_List := Holes;
        Prev : Hole_List := null;
        Temp : Hole_List;
    begin
        Success := True;

        if Lo > Hi then
            return;
        end if;

        -- H may be null, which raises constraint error
        -- exception is caught and success set to false
        while Lo > H.Hi loop
            Prev := H;
            H    := H.Next;
        end loop;

        pragma Assert (H.Lo <= Lo and Hi <= H.Hi);
        -- may fail and raise assertion error
        -- exception is caught and success set to false

        -- H.Lo <= Lo <= Hi <= H.Hi

        if Lo = H.Lo and Hi = H.Hi then
            -- evaporate hole
            if Prev = null then
                Holes := H.Next;
            else
                Prev.Next := H.Next;
            end if;
        elsif Lo = H.Lo then
            -- contract hole
            H.Lo := Hi + One;
        elsif Hi = H.Hi then
            -- contract hole
            H.Hi := Lo - One;
        else
            -- split hole
            Temp   := H.Next;
            H.Next := new Hole_Descriptor'
                             (Lo => Hi + One, Hi => H.Hi, Next => null);

            H.Next.Next := Temp;
            H.Hi        := Lo - One;
        end if;
    exception
        when others =>
            Success := False;
    end Delete_Hole;

    procedure Next_Hole (Holes : in out Hole_List; Lo, Hi : out Long_Integer) is
    begin
        Lo    := Holes.Lo;
        Hi    := Holes.Hi;
        Holes := Holes.Next;
    end Next_Hole;

    function More_Holes (Holes : Hole_List) return Boolean is
    begin
        return Holes /= null;
    end More_Holes;

end Discrete_Hole_Manager;

E3 Meta Data

    nblk1=4
    nid=0
    hdr6=8
        [0x00] rec0=22 rec1=00 rec2=01 rec3=02e
        [0x01] rec0=00 rec1=00 rec2=04 rec3=00c
        [0x02] rec0=22 rec1=00 rec2=02 rec3=028
        [0x03] rec0=0a rec1=00 rec2=03 rec3=001
    tail 0x21700246c815c65db8abe 0x42a00088462061e03