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

⟦ac39d1c24⟧ TextFile

    Length: 3920 (0xf50)
    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 Class_Id;
with Condition;
with Text_Io;
package body Generic_Fact is

    Class_Identity : Integer := Class_Id.Value (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 Map (Slot_Name : Slot_Names) return Fact.Slot_Names is
    begin
        return Slot_Names'Pos (Slot_Name) -
                  Slot_Names'Pos (Slot_Names'First) + 2;
    end Map;

    -- function Reverse_Map (Anonyme_Slot : Fact.Slot_Names) return Slot_Names is
    --
    -- begin
    --     return Slot_Names'Val (Anonyme_Slot - 1);
    -- end Reverse_Map;
    --
    function Anonymous_Length return Natural is
    begin
        return Slot_Count + 1;
    end Anonymous_Length;

    function As_Anonymous (What : Pattern) return Fact.Pattern is
        use Condition;
        Result : Fact.Pattern (1 .. Slot_Count + 1);
    begin
        Result (1) := Is_Equal (Class_Identity);
        for Slot_Name in What'Range loop
            Result (Map (Slot_Name)) := What (Slot_Name);
        end loop;
        return Result;
    end As_Anonymous;

    function As_Anonymous (What : Frame) return Fact.Frame is
        Result : Fact.Frame (1 .. Slot_Count + 1);
    begin
        Result (1) := Class_Identity;
        for Slot_Name in What'Range loop
            Result (Map (Slot_Name)) := What (Slot_Name);
        end loop;
        return Result;
    end As_Anonymous;

    function Exist (What : Pattern) return Fact.Query is
    begin
        return Fact.Query'(Kind  => Fact.Find,
                           Size  => Anonymous_Length,
                           Value => As_Anonymous (What));
    end Exist;


    function Absent (What : Pattern) return Fact.Query is
    begin
        return Fact.Query'(Kind  => Fact.Check_No,
                           Size  => Anonymous_Length,
                           Value => As_Anonymous (What));

    end Absent;

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

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

    procedure Add (The_Fact : Frame) is
    begin
        Fact.Add (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 : Frame) is
    begin
        Fact.Change (The_Fact, As_Anonymous (Value));
    end Change;

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

    function Value_Image (The_Fact : Fact.Name) return String is
        function Recursive_Image (Starting_At : Slot_Names) return String is
            The_Value : constant Integer := Get (The_Fact, Slot => Starting_At);
            Result : constant String := ", " & Slot_Names'Image (Starting_At) &
                                           " => " & Attribute_Image (The_Value);
        begin  
            if Starting_At /= Slot_Names'Last then
                return Result & Recursive_Image (Slot_Names'Succ (Starting_At));
            else
                return Result;
            end if;
        end Recursive_Image;
    begin
        return Recursive_Image (Starting_At => Slot_Names'First);
    end Value_Image;

    function Image (The_Fact : Fact.Name) return String is
    begin
        return "Class => " & Class_Name & Value_Image (The_Fact);
    end Image;

end Generic_Fact;