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

⟦eec324207⟧ Ada Source

    Length: 28672 (0x7000)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Iterator, package body Tuplecollection, seg_00dc6f, separate Expertsystem

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



separate (Expertsystem)

package body Tuplecollection is

    function Getref (C : Collection.Object; Number : Positive := 1)
                    return Expertsystem.Reference renames Collection.Get;

    function Card (C : Collection.Object) return Natural
        renames Collection.Cardinality;

    function Get (Thetuplecollection : Tuplecollection.Object;
                  Number : Positive := 1) return Expertsystem.Reference is
    begin
        if Number > Thetuplecollection.Count then
            return Nullreference;
        else
            return Thetuplecollection.Cells (Number);
        end if;
    end Get;

    function Isfull (Thetuplecollection : Tuplecollection.Object)
                    return Boolean is
    begin
        return Thetuplecollection.Count >= Thetuplecollection.Size;
    end Isfull;

    procedure Add (Thetuplecollection : in out Tuplecollection.Object;
                   Aref : Expertsystem.Reference) is
    begin
        if Isfull (Thetuplecollection) then
            declare
                Bigtuplecoll : Tuplecollection.Object
                                  (Thetuplecollection.Size +
                                   Thetuplecollection.Size / 2);
            begin
                Bigtuplecoll.Cells (1 .. Thetuplecollection.Size) :=
                   Thetuplecollection.Cells (1 .. Thetuplecollection.Size);
                Bigtuplecoll.Count := Thetuplecollection.Count;
                Bigtuplecoll.Unity := Thetuplecollection.Unity;
                Thetuplecollection := Bigtuplecoll;
            end;
        end if;
        Thetuplecollection.Count := Thetuplecollection.Count + 1;
        Thetuplecollection.Cells (Thetuplecollection.Count) := Aref;
    end Add;

    procedure Merge (Thetuplecollection : in out Tuplecollection.Object;
                     R1 : Expertsystem.Reference := Nullreference;
                     R2 : Expertsystem.Reference := Nullreference;
                     R3 : Expertsystem.Reference := Nullreference;
                     R4 : Expertsystem.Reference := Nullreference;
                     R5 : Expertsystem.Reference := Nullreference;
                     R6 : Expertsystem.Reference := Nullreference;
                     R7 : Expertsystem.Reference := Nullreference;
                     R8 : Expertsystem.Reference := Nullreference;
                     R9 : Expertsystem.Reference := Nullreference;
                     R10 : Expertsystem.Reference := Nullreference) is
    begin
        if R1 /= Nullreference then
            Add (Thetuplecollection, R1);
        end if;
        if R2 /= Nullreference then
            Add (Thetuplecollection, R2);
        end if;
        if R3 /= Nullreference then
            Add (Thetuplecollection, R3);
        end if;
        if R4 /= Nullreference then
            Add (Thetuplecollection, R4);
        end if;
        if R4 /= Nullreference then
            Add (Thetuplecollection, R4);
        end if;
        if R5 /= Nullreference then
            Add (Thetuplecollection, R5);
        end if;
        if R6 /= Nullreference then
            Add (Thetuplecollection, R6);
        end if;
        if R7 /= Nullreference then
            Add (Thetuplecollection, R7);
        end if;
        if R8 /= Nullreference then
            Add (Thetuplecollection, R8);
        end if;
        if R9 /= Nullreference then
            Add (Thetuplecollection, R9);
        end if;
        if R10 /= Nullreference then
            Add (Thetuplecollection, R10);
        end if;

    end Merge;

    function Cardinality
                (Thetuplecollection : Tuplecollection.Object) return Natural is
    begin
        return Thetuplecollection.Count / Thetuplecollection.Unity;
    end Cardinality;

    function Isnull (Thetuplecollection : Tuplecollection.Object)
                    return Boolean is
    begin
        return Thetuplecollection.Count = 0;
    end Isnull;

    function Isnotnull
                (Thetuplecollection : Tuplecollection.Object) return Boolean is
    begin
        return Thetuplecollection.Count /= 0;
    end Isnotnull;

    function Join1 (C1 : Collection.Object; Quantity : Natural := 1)
                   return Tuplecollection.Object is
        Thetuplecollection : Tuplecollection.Object;
        R1 : Expertsystem.Reference;
    begin
        Thetuplecollection.Count := 0;
        Thetuplecollection.Unity := 1;
        for I in 1 .. Card (C1) loop
            R1 := Getref (C1, I);
            if Match (R1) then
                Merge (Thetuplecollection, R1);
                if (Quantity /= Any) and then
                   (Thetuplecollection.Count / Thetuplecollection.Unity >=
                    Quantity) then
                    return Thetuplecollection;
                end if;
            end if;
        end loop;
        return Thetuplecollection;
    end Join1;

    function Join2 (C1, C2 : Collection.Object; Quantity : Natural := 1)
                   return Tuplecollection.Object is
        Thetuplecollection : Tuplecollection.Object;
        R1, R2 : Expertsystem.Reference;
    begin
        Thetuplecollection.Count := 0;
        Thetuplecollection.Unity := 2;
        for I in 1 .. Card (C1) loop
            R1 := Getref (C1, I);
            for J in 1 .. Card (C2) loop
                R2 := Getref (C2, J);
                if Match (R1, R2) then
                    Merge (Thetuplecollection, R1, R2);
                    if (Quantity /= Any) and then
                       (Thetuplecollection.Count / Thetuplecollection.Unity >=
                        Quantity) then
                        return Thetuplecollection;
                    end if;
                end if;
            end loop;
        end loop;
        return Thetuplecollection;
    end Join2;

    function Join3 (C1, C2, C3 : Collection.Object; Quantity : Natural := 1)
                   return Tuplecollection.Object is
        Thetuplecollection : Tuplecollection.Object;
        R1, R2, R3 : Expertsystem.Reference;
    begin
        Thetuplecollection.Count := 0;
        Thetuplecollection.Unity := 3;
        for I in 1 .. Card (C1) loop
            R1 := Getref (C1, I);
            for J in 1 .. Card (C2) loop
                R2 := Getref (C2, J);
                for K in 1 .. Card (C3) loop
                    R3 := Getref (C3, K);
                    if Match (R1, R2, R3) then
                        Merge (Thetuplecollection, R1, R2, R3);
                        if (Quantity /= Any) and then
                           (Thetuplecollection.Count /
                            Thetuplecollection.Unity >= Quantity) then
                            return Thetuplecollection;
                        end if;
                    end if;
                end loop;
            end loop;
        end loop;
        return Thetuplecollection;
    end Join3;

    function Join4 (C1, C2, C3, C4 : Collection.Object; Quantity : Natural := 1)
                   return Tuplecollection.Object is
        Thetuplecollection : Tuplecollection.Object;
        R1, R2, R3, R4 : Expertsystem.Reference;
    begin
        Thetuplecollection.Count := 0;
        Thetuplecollection.Unity := 4;
        for I in 1 .. Card (C1) loop
            R1 := Getref (C1, I);
            for J in 1 .. Card (C2) loop
                R2 := Getref (C2, J);
                for K in 1 .. Card (C3) loop
                    R3 := Getref (C3, K);
                    for L in 1 .. Card (C4) loop
                        R4 := Getref (C4, L);
                        if Match (R1, R2, R3, R4) then
                            Merge (Thetuplecollection, R1, R2, R3, R4);
                            if (Quantity /= Any) and then
                               (Thetuplecollection.Count /
                                Thetuplecollection.Unity >= Quantity) then
                                return Thetuplecollection;
                            end if;
                        end if;
                    end loop;
                end loop;
            end loop;
        end loop;
        return Thetuplecollection;
    end Join4;

    function Join5 (C1, C2, C3, C4, C5 : Collection.Object;
                    Quantity : Natural := 1) return Tuplecollection.Object is
        Thetuplecollection : Tuplecollection.Object;
        R1, R2, R3, R4, R5 : Expertsystem.Reference;
    begin
        Thetuplecollection.Count := 0;
        Thetuplecollection.Unity := 5;
        for I in 1 .. Card (C1) loop
            R1 := Getref (C1, I);
            for J in 1 .. Card (C2) loop
                R2 := Getref (C2, J);
                for K in 1 .. Card (C3) loop
                    R3 := Getref (C3, K);
                    for L in 1 .. Card (C4) loop
                        R4 := Getref (C4, L);
                        for M in 1 .. Card (C5) loop
                            R5 := Getref (C5, M);
                            if Match (R1, R2, R3, R4, R5) then
                                Merge (Thetuplecollection, R1, R2, R3, R4, R5);
                                if (Quantity /= Any) and then
                                   (Thetuplecollection.Count /
                                    Thetuplecollection.Unity >= Quantity) then
                                    return Thetuplecollection;
                                end if;
                            end if;
                        end loop;
                    end loop;
                end loop;
            end loop;
        end loop;
        return Thetuplecollection;
    end Join5;

    function Join6 (C1, C2, C3, C4, C5, C6 : Collection.Object;
                    Quantity : Natural := 1) return Tuplecollection.Object is
        Thetuplecollection : Tuplecollection.Object;
        R1, R2, R3, R4, R5, R6 : Expertsystem.Reference;
    begin
        Thetuplecollection.Count := 0;
        Thetuplecollection.Unity := 6;
        for I in 1 .. Card (C1) loop
            R1 := Getref (C1, I);
            for J in 1 .. Card (C2) loop
                R2 := Getref (C2, J);
                for K in 1 .. Card (C3) loop
                    R3 := Getref (C3, K);
                    for L in 1 .. Card (C4) loop
                        R4 := Getref (C4, L);
                        for M in 1 .. Card (C5) loop
                            R5 := Getref (C5, M);
                            for N in 1 .. Card (C6) loop
                                R6 := Getref (C6, N);
                                if Match (R1, R2, R3, R4, R5, R6) then
                                    Merge (Thetuplecollection, R1,
                                           R2, R3, R4, R5, R6);
                                    if (Quantity /= Any) and then
                                       (Thetuplecollection.Count /
                                        Thetuplecollection.Unity >=
                                        Quantity) then
                                        return Thetuplecollection;
                                    end if;
                                end if;
                            end loop;
                        end loop;
                    end loop;
                end loop;
            end loop;
        end loop;
        return Thetuplecollection;
    end Join6;

    function Join7 (C1, C2, C3, C4, C5, C6, C7 : Collection.Object;
                    Quantity : Natural := 1) return Tuplecollection.Object is
        Thetuplecollection : Tuplecollection.Object;
        R1, R2, R3, R4, R5, R6, R7 : Expertsystem.Reference;
    begin
        Thetuplecollection.Count := 0;
        Thetuplecollection.Unity := 7;
        for I in 1 .. Card (C1) loop
            R1 := Getref (C1, I);
            for J in 1 .. Card (C2) loop
                R2 := Getref (C2, J);
                for K in 1 .. Card (C3) loop
                    R3 := Getref (C3, K);
                    for L in 1 .. Card (C4) loop
                        R4 := Getref (C4, L);
                        for M in 1 .. Card (C5) loop
                            R5 := Getref (C5, M);
                            for N in 1 .. Card (C6) loop
                                R6 := Getref (C6, N);
                                for P in 1 .. Card (C7) loop
                                    R7 := Getref (C7, P);
                                    if Match (R1, R2, R3, R4, R5, R6, R7) then
                                        Merge (Thetuplecollection, R1,
                                               R2, R3, R4, R5, R6, R7);
                                        if (Quantity /= Any) and then
                                           (Thetuplecollection.Count /
                                            Thetuplecollection.Unity >=
                                            Quantity) then
                                            return Thetuplecollection;
                                        end if;
                                    end if;
                                end loop;
                            end loop;
                        end loop;
                    end loop;
                end loop;
            end loop;
        end loop;
        return Thetuplecollection;
    end Join7;

    function Join8 (C1, C2, C3, C4, C5, C6, C7, C8 : Collection.Object;
                    Quantity : Natural := 1) return Tuplecollection.Object is
        Thetuplecollection : Tuplecollection.Object;
        R1, R2, R3, R4, R5, R6, R7, R8 : Expertsystem.Reference;
    begin
        Thetuplecollection.Count := 0;
        Thetuplecollection.Unity := 8;
        for I in 1 .. Card (C1) loop
            R1 := Getref (C1, I);
            for J in 1 .. Card (C2) loop
                R2 := Getref (C2, J);
                for K in 1 .. Card (C3) loop
                    R3 := Getref (C3, K);
                    for L in 1 .. Card (C4) loop
                        R4 := Getref (C4, L);
                        for M in 1 .. Card (C5) loop
                            R5 := Getref (C5, M);
                            for N in 1 .. Card (C6) loop
                                R6 := Getref (C6, N);
                                for P in 1 .. Card (C7) loop
                                    R7 := Getref (C7, P);
                                    for Q in 1 .. Card (C8) loop
                                        R8 := Getref (C8, Q);
                                        if Match (R1, R2, R3, R4, R5,
                                                  R6, R7, R8) then
                                            Merge (Thetuplecollection, R1, R2,
                                                   R3, R4, R5, R6, R7, R8);
                                            if (Quantity /= Any) and then
                                               (Thetuplecollection.Count /
                                                Thetuplecollection.Unity >=
                                                Quantity) then
                return Thetuplecollection;
                                            end if;
                                        end if;
                                    end loop;
                                end loop;
                            end loop;
                        end loop;
                    end loop;
                end loop;
            end loop;
        end loop;
        return Thetuplecollection;
    end Join8;

    function Join9 (C1, C2, C3, C4, C5, C6, C7, C8, C9 : Collection.Object;
                    Quantity : Natural := 1) return Tuplecollection.Object is
        Thetuplecollection : Tuplecollection.Object;
        R1, R2, R3, R4, R5, R6, R7, R8, R9 : Expertsystem.Reference;
    begin
        Thetuplecollection.Count := 0;
        Thetuplecollection.Unity := 9;
        for I in 1 .. Card (C1) loop
            R1 := Getref (C1, I);
            for J in 1 .. Card (C2) loop
                R2 := Getref (C2, J);
                for K in 1 .. Card (C3) loop
                    R3 := Getref (C3, K);
                    for L in 1 .. Card (C4) loop
                        R4 := Getref (C4, L);
                        for M in 1 .. Card (C5) loop
                            R5 := Getref (C5, M);
                            for N in 1 .. Card (C6) loop
                                R6 := Getref (C6, N);
                                for P in 1 .. Card (C7) loop
                                    R7 := Getref (C7, P);
                                    for Q in 1 .. Card (C8) loop
                                        R8 := Getref (C8, Q);
                                        for R in 1 .. Card (C9) loop
                                            R9 := Getref (C9, R);
                                            if Match (R1, R2, R3, R4, R5,
                                                      R6, R7, R8, R9) then
                Merge (Thetuplecollection, R1, R2, R3, R4, R5, R6, R7, R8, R9);
                if (Quantity /= Any) and then
                   (Thetuplecollection.Count / Thetuplecollection.Unity >=
                    Quantity) then
                    return Thetuplecollection;
                end if;
                                            end if;
                                        end loop;
                                    end loop;
                                end loop;
                            end loop;
                        end loop;
                    end loop;
                end loop;
            end loop;
        end loop;
        return Thetuplecollection;
    end Join9;

    function Join10 (C1, C2, C3, C4, C5, C6, C7, C8, C9, C10 :
                        Collection.Object;
                     Quantity : Natural := 1) return Tuplecollection.Object is
        Thetuplecollection : Tuplecollection.Object;
        R1, R2, R3, R4, R5, R6, R7, R8, R9, R10 : Expertsystem.Reference;
    begin
        Thetuplecollection.Count := 0;
        Thetuplecollection.Unity := 10;
        for I in 1 .. Card (C1) loop
            R1 := Getref (C1, I);
            for J in 1 .. Card (C2) loop
                R2 := Getref (C2, J);
                for K in 1 .. Card (C3) loop
                    R3 := Getref (C3, K);
                    for L in 1 .. Card (C4) loop
                        R4 := Getref (C4, L);
                        for M in 1 .. Card (C5) loop
                            R5 := Getref (C5, M);
                            for N in 1 .. Card (C6) loop
                                R6 := Getref (C6, N);
                                for P in 1 .. Card (C7) loop
                                    R7 := Getref (C7, P);
                                    for Q in 1 .. Card (C8) loop
                                        R8 := Getref (C8, Q);
                                        for R in 1 .. Card (C9) loop
                                            R9 := Getref (C9, R);
                                            for S in 1 .. Card (C10) loop
                R10 := Getref (C10, S);
                if Match (R1, R2, R3, R4, R5, R6, R7, R8, R9, R10) then
                    Merge (Thetuplecollection, R1, R2, R3,
                           R4, R5, R6, R7, R8, R9, R10);
                    if (Quantity /= Any) and then
                       (Thetuplecollection.Count / Thetuplecollection.Unity >=
                        Quantity) then
                        return Thetuplecollection;
                    end if;
                end if;
                                            end loop;
                                        end loop;
                                    end loop;
                                end loop;
                            end loop;
                        end loop;
                    end loop;
                end loop;
            end loop;
        end loop;
        return Thetuplecollection;
    end Join10;

    function Themost (Thetuplecollection : Object) return Tuple.Object is
        Tu, Ti : Tuple.Object;
    begin
        if Thetuplecollection.Count /= 0 then
            Tu := First (Thetuplecollection);
            for I in 2 .. Thetuplecollection.Count /
                             Thetuplecollection.Unity loop
                Ti := Get (Thetuplecollection, I);
                if not Predicate (Tu, Ti) then
                    Tu := Ti;
                end if;
            end loop;
        end if;
        return Tu;
    end Themost;

    function Restrict (Thetuplecollection : Tuplecollection.Object;
                       Quantity : Natural := Any)
                      return Tuplecollection.Object is
        Result : Tuplecollection.Object;
        Ti : Tuple.Object;
    begin
        if Thetuplecollection.Count /= 0 then
            Result.Unity := Thetuplecollection.Unity;
            for I in 1 .. Thetuplecollection.Count /
                             Thetuplecollection.Unity loop
                Ti := Get (Thetuplecollection, I);
                if Predicate (Ti) then
                    for J in 1 .. Thetuplecollection.Unity loop
                        Add (Result, Tuple.Get (Ti, J));
                    end loop;
                    if (Quantity /= Any) and then
                       (Result.Count / Result.Unity >= Quantity) then
                        return Result;
                    end if;
                end if;
            end loop;
        end if;
        return Result;
    end Restrict;

    function Findone (Thetuplecollection : Tuplecollection.Object)
                     return Tuple.Object is
        T : Tuple.Object;
    begin
        if Thetuplecollection.Count /= 0 then
            for I in 1 .. Thetuplecollection.Count /
                             Thetuplecollection.Unity loop
                T := Get (Thetuplecollection, I);
                if Predicate (T) then
                    return T;
                end if;
            end loop;
        end if;
        return T;
    end Findone;

    function Get (Thetuplecollection : Tuplecollection.Object;
                  Number : Positive := 1) return Tuple.Object is
        Tu : Tuple.Object;
    begin
        if Number <= Thetuplecollection.Count / Thetuplecollection.Unity then
            for I in 1 .. Thetuplecollection.Unity loop
                Tuple.Add (Tu,
                           Get (Thetuplecollection,
                                (Number - 1) * Thetuplecollection.Unity + I));
            end loop;
        end if;
        return Tu;
    end Get;

    function First (Thetuplecollection : Tuplecollection.Object)
                   return Tuple.Object is
    begin
        return Get (Thetuplecollection, 1);
    end First;

    function Get (Thetuplecollection : Tuplecollection.Object;
                  Frompos : Positive := 1;
                  Topos : Positive)  
                 return Tuplecollection.Object is
        Tuc : Tuplecollection.Object;
        Bornefrom : Natural;
        Borneto : Natural;
    begin
        if Topos > Thetuplecollection.Count / Thetuplecollection.Unity then
            Borneto := Thetuplecollection.Count / Thetuplecollection.Unity;
        else
            Borneto := Topos;
        end if;
        if Frompos < Thetuplecollection.Cells'First then
            Bornefrom := Thetuplecollection.Cells'First;
        else
            Bornefrom := Frompos;
        end if;

        Tuc.Unity := Thetuplecollection.Unity;
        for I in Bornefrom .. Thetuplecollection.Unity * Borneto loop
            Add (Tuc, Get (Thetuplecollection, I));
        end loop;
        return Tuc;
    end Get;

    procedure Forall (Thetuplecollection : Tuplecollection.Object) is
    begin
        for I in 1 .. Thetuplecollection.Count / Thetuplecollection.Unity loop
            declare
                Tu : Tuple.Object;
            begin
                for J in 1 .. Thetuplecollection.Unity loop
                    Tuple.Add (Tu, Get
                                      (Thetuplecollection,
                                       (I - 1) * Thetuplecollection.Unity + J));
                end loop;
                Action (Tu);
            end;
        end loop;
    end Forall;


    package body Iterator is
        function Open (Thetuplecollection : Tuplecollection.Object)
                      return Iter is
        begin
            if Thetuplecollection.Count = 0 then
                return 0;
            else
                return 1;
            end if;
        end Open;

        function Get (Thetuplecollection : Tuplecollection.Object; I : Iter)
                     return Tuple.Object is
        begin
            if I > Iter (Thetuplecollection.Count /
                         Thetuplecollection.Unity) then
                raise Illegalaccess;
            end if;
            return Get (Thetuplecollection, Positive (I));
        exception
            when Constraint_Error =>
                raise Illegalaccess;
        end Get;

        function Next (Thetuplecollection : Tuplecollection.Object; I : Iter)
                      return Iter is
            Idx : Integer;
        begin
            Idx := Integer (I) + 1;
            if Idx > Thetuplecollection.Count / Thetuplecollection.Unity then
                return 0;
            else
                return Iter (Idx);
            end if;
        exception
            when Constraint_Error =>
                raise Illegalaccess;
        end Next;

        function Atend (Thetuplecollection : Tuplecollection.Object; I : Iter)
                       return Boolean is
        begin
            return I = 0;
        end Atend;
    end Iterator;

end Tuplecollection;

E3 Meta Data

    nblk1=1b
    nid=0
    hdr6=36
        [0x00] rec0=1e rec1=00 rec2=01 rec3=00e
        [0x01] rec0=14 rec1=00 rec2=02 rec3=082
        [0x02] rec0=17 rec1=00 rec2=03 rec3=00e
        [0x03] rec0=1f rec1=00 rec2=04 rec3=012
        [0x04] rec0=1c rec1=00 rec2=05 rec3=010
        [0x05] rec0=1b rec1=00 rec2=06 rec3=00c
        [0x06] rec0=15 rec1=00 rec2=07 rec3=02e
        [0x07] rec0=18 rec1=00 rec2=08 rec3=046
        [0x08] rec0=19 rec1=00 rec2=09 rec3=032
        [0x09] rec0=15 rec1=00 rec2=0a rec3=08e
        [0x0a] rec0=15 rec1=00 rec2=0b rec3=02c
        [0x0b] rec0=17 rec1=00 rec2=0c rec3=026
        [0x0c] rec0=12 rec1=00 rec2=0d rec3=056
        [0x0d] rec0=17 rec1=00 rec2=0e rec3=040
        [0x0e] rec0=13 rec1=00 rec2=0f rec3=006
        [0x0f] rec0=15 rec1=00 rec2=10 rec3=014
        [0x10] rec0=14 rec1=00 rec2=11 rec3=05e
        [0x11] rec0=15 rec1=00 rec2=12 rec3=016
        [0x12] rec0=16 rec1=00 rec2=13 rec3=050
        [0x13] rec0=12 rec1=00 rec2=14 rec3=01a
        [0x14] rec0=1d rec1=00 rec2=15 rec3=01c
        [0x15] rec0=17 rec1=00 rec2=16 rec3=012
        [0x16] rec0=1a rec1=00 rec2=17 rec3=068
        [0x17] rec0=1d rec1=00 rec2=18 rec3=01c
        [0x18] rec0=1e rec1=00 rec2=19 rec3=00c
        [0x19] rec0=1c rec1=00 rec2=1a rec3=038
        [0x1a] rec0=0f rec1=00 rec2=1b rec3=000
    tail 0x21509b30e821a48a6c29e 0x42a00088462060003