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

⟦b7b86bc73⟧ TextFile

    Length: 3778 (0xec2)
    Types: TextFile
    Names: »B«

Derivation

└─⟦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 Constant_String;
with Text_Io;
package body Generic_Fact is

    Class_Identity : Constant_String.Object :=
       Constant_String.Make (Class_Name);

    function Slot_Count return Natural is
        First : Natural := Slot_Names'Pos (Slot_Names'First);
        Last  : Natural := Slot_Names'Pos (Slot_Names'Last);
    begin
        return Last - First + 1;
    end Slot_Count;


    function As_Fact_Slot_Name
                (Slot_Name : Slot_Names) return Fact.Slot_Names is
    begin
        return Slot_Names'Pos (Slot_Name) -
                  Slot_Names'Pos (Slot_Names'First) + 1;
    end As_Fact_Slot_Name;


    function As_Anonymous (What : Patterns) return Fact.Patterns is
        Result : Fact.Patterns (1 .. Slot_Count);
    begin  
        for Slot_Name in What'Range loop
            Result (As_Fact_Slot_Name (Slot_Name)) := What (Slot_Name);
        end loop;
        return Result;
    end As_Anonymous;


    function As_Anonymous (What : Slots) return Fact.Slots is
        Result : Fact.Slots (1 .. Slot_Count);
    begin
        for Slot_Name in What'Range loop
            Result (As_Fact_Slot_Name (Slot_Name)) := What (Slot_Name);
        end loop;
        return Result;
    end As_Anonymous;


    function Exist (What : Patterns) return Fact.Query is
    begin
        return Fact.Query'(Kind  => Fact.Find,
                           Class => Class_Identity,
                           Size  => Slot_Count,
                           Value => As_Anonymous (What));
    end Exist;


    function Not_Any (What : Patterns) return Fact.Query is
    begin
        return Fact.Query'(Kind  => Fact.Check_No,
                           Class => Class_Identity,
                           Size  => Slot_Count,
                           Value => As_Anonymous (What));
    end Not_Any;

    function Get (The_Fact : Fact.Name; Slot : Slot_Names) return Integer is
    begin
        return Fact.Get (The_Fact, Slot => As_Fact_Slot_Name (Slot));
    end Get;

    function Get (The_Fact : Fact.Name) return Slots is
        Result : Slots;
    begin
        for Slot in Slot_Names loop
            Result (Slot) := Fact.Get (The_Fact,
                                       Slot => As_Fact_Slot_Name (Slot));
        end loop;
        return Result;
    end Get;

    procedure Add (The_Fact : Slots) is
    begin
        Fact.Add ((Size  => The_Fact'Length,
                   Class => Class_Identity,
                   Value => As_Anonymous (The_Fact)));
    end Add;

    procedure Delete (The_Fact : Fact.Name) is
    begin
        Fact.Delete (The_Fact);
    end Delete;

    procedure Change (The_Fact : Fact.Name; Value : Slots) is
    begin
        Fact.Change (The_Fact,
                     Value => (Size  => Value'Length,
                               Class => Class_Identity,
                               Value => As_Anonymous (Value)));
    end Change;

    procedure Change (The_Fact : Fact.Name;
                      The_Slot : Slot_Names;
                      To_Value : Integer) is
    begin
        Fact.Change (The_Fact, As_Fact_Slot_Name (The_Slot), To_Value);
    end Change;

    procedure Put (The_Fact : Fact.Name; Where : Output_Stream.Object) is
        First : Boolean := True;
        use Output_Stream;
    begin
        Put (Class_Name & "'(", Where);
        Indent_Right (Where);
        New_Line (Where);
        for I in Slot_Names loop
            if not First then
                Put_Line (", ", Where);
            else
                First := False;
            end if;
            Put (Slot_Names'Image (I) & " =>", Where);
            Put (Attribute_Image (Get (The_Fact, Slot => I)), Where);
        end loop;
        Indent_Left (Where);
        Put_Line (")", Where);
    end Put;

end Generic_Fact;