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

⟦5637b1f83⟧ TextFile

    Length: 2570 (0xa0a)
    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⟧ 
└─⟦a7d1ea751⟧ Bits:30000550 8mm tape, Rational 1000, !users!projects 94_04_11
    └─ ⟦129cab021⟧ »DATA« 
        └─⟦e24fb53b7⟧ 
            └─⟦this⟧ 

TextFile

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;