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

⟦8e27f7920⟧ Ada Source

    Length: 8192 (0x2000)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Generic_Fact, seg_02ae3e

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



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;

E3 Meta Data

    nblk1=7
    nid=5
    hdr6=a
        [0x00] rec0=22 rec1=00 rec2=01 rec3=02c
        [0x01] rec0=1e rec1=00 rec2=07 rec3=062
        [0x02] rec0=1e rec1=00 rec2=04 rec3=00a
        [0x03] rec0=17 rec1=00 rec2=03 rec3=01c
        [0x04] rec0=0b rec1=00 rec2=02 rec3=000
        [0x05] rec0=0b rec1=00 rec2=02 rec3=000
        [0x06] rec0=44 rec1=e4 rec2=00 rec3=002
    tail 0x215232f6283e58400204b 0x42a00088462063c03
Free Block Chain:
  0x5: 0000  00 06 03 fc 80 01 3b 01 00 14 20 20 20 20 2d 2d  ┆      ;       --┆
  0x6: 0000  00 00 00 22 80 02 29 3b 02 00 0f 20 20 20 20 65  ┆   "  );       e┆