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

⟦d9e6333a1⟧ Ada Source

    Length: 11264 (0x2c00)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Generic_Rule_Base, package body Generic_Rule_Bundle, seg_02aee1

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



with Fact;
package body Generic_Rule_Base is

    Max_Rule_Count      : constant          := 50;
    At_End_Value        : constant Iterator := 0;
    Max_Queries_By_Rule : constant          := 10;

    Last_Rule : Natural := 0;

    subtype Premiss_Size is Natural range 0 .. Max_Queries_By_Rule;

    type Rule (The_Query_Count : Premiss_Size := 0) is
        record
            The_Id      : Rule_Id := No_Rule;
            The_Premiss : Fact.Join_Descriptor (1 .. The_Query_Count) :=
               Fact.Null_Premiss;
        end record;

    type Rules is array (Positive range <>) of Rule;

    The_Rules           : Rules (1 .. Max_Rule_Count);
    The_Last_Fired_Rule : Rule_Id := No_Rule;

    function Get (R : Rule_Id) return Rule_Bundles is
    begin
        return R.The_Bundle;
    end Get;

    function Firable_On_Facts return Fact.Collection is
        use Fact;
    begin
        The_Last_Fired_Rule := No_Rule;
        for I in The_Rules'First .. Last_Rule loop
            declare
                Answer : constant Fact.Collection :=
                   Fact.Retrieve (The_Rules (I).The_Premiss);
            begin
                if Answer /= Empty_Collection then
                    The_Last_Fired_Rule := The_Rules (I).The_Id;
                    return Answer;
                end if;
            end;
        end loop;
        return Empty_Collection;
    end Firable_On_Facts;

    function Firable_On_Rule return Rule_Id is
    begin
        return The_Last_Fired_Rule;
    end Firable_On_Rule;

    function Open return Iterator is  
        Result : Iterator := At_End_Value;
    begin
        for I in The_Rules'First .. Last_Rule loop
            if The_Rules (I).The_Id.Is_Valid then
                Result := Iterator (I);
                exit;
            end if;
        end loop;
        return Result;
    end Open;

    function Value (I : Iterator) return Rule_Id is
    begin
        return The_Rules (Positive (I)).The_Id;
    end Value;

    function Next (I : Iterator) return Iterator is
        Result : Iterator := At_End_Value;
    begin
        if not At_End (I) then
            for N in Positive (I + 1) .. Last_Rule loop
                if The_Rules (N).The_Id.Is_Valid then
                    Result := Iterator (N);
                    exit;
                end if;
            end loop;
        end if;
        return Result;
    end Next;

    function At_End (I : Iterator) return Boolean is
    begin
        return I = 0;
    end At_End;

    package body Generic_Rule_Bundle is separate;
end Generic_Rule_Base;

E3 Meta Data

    nblk1=a
    nid=4
    hdr6=6
        [0x00] rec0=22 rec1=00 rec2=01 rec3=028
        [0x01] rec0=1f rec1=00 rec2=08 rec3=066
        [0x02] rec0=1a rec1=00 rec2=09 rec3=000
        [0x03] rec0=18 rec1=00 rec2=07 rec3=058
        [0x04] rec0=20 rec1=00 rec2=09 rec3=000
        [0x05] rec0=15 rec1=00 rec2=02 rec3=02e
        [0x06] rec0=06 rec1=00 rec2=06 rec3=04a
        [0x07] rec0=18 rec1=00 rec2=07 rec3=058
        [0x08] rec0=20 rec1=00 rec2=09 rec3=000
        [0x09] rec0=41 rec1=07 rec2=b6 rec3=430
    tail 0x21724037c83e5854d441b 0x42a00088462063c03
Free Block Chain:
  0x4: 0000  00 07 02 c0 80 28 20 72 65 74 75 72 6e 20 54 68  ┆     ( return Th┆
  0x7: 0000  00 06 03 fb 80 15 20 20 3d 3e 20 41 73 5f 4e 61  ┆        => As_Na┆
  0x6: 0000  00 02 02 11 00 49 20 20 20 20 20 20 20 20 2d 2d  ┆     I        --┆
  0x2: 0000  00 05 03 fa 80 18 20 4e 75 6c 6c 5f 41 63 74 69  ┆       Null_Acti┆
  0x5: 0000  00 03 03 fc 80 23 28 54 68 65 5f 51 75 65 72 79  ┆     #(The_Query┆
  0x3: 0000  00 0a 03 fc 80 06 63 74 69 6f 6e 3b 06 00 20 20  ┆      ction;    ┆
  0xa: 0000  00 00 03 fc 80 06 63 74 69 6f 6e 3b 06 00 20 20  ┆      ction;    ┆