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

⟦a82dd6426⟧ Ada Source

    Length: 16384 (0x4000)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, package body F_General_Bundle, package body Make_Sub_Goals_Rule, package body Resolve_Sub_Goals_Rule, package body Stop_Condition_Rule, seg_03b8f3

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 Alias;
with F_Frames;
with Output_Stream;
with Slot;  
use Slot;
package body F_General_Bundle is

    use Alias;
    use F_Frames;
    use F_Kbs.Kbs.Predicate;
    use F_Kbs.Kbs.Predicate.System_Defined_Predicate;
    use F_Kbs.Kbs.Expression.System_Defined_Expression;
    use F_Kbs.Kbs.Expression;
    use F_Kbs.Kbs;

    type Rule_Names is (Stop_Condition, Resolve_Sub_Goals,
                        Make_Sub_Goals, No_More);

    ---------------------------------------------------------------------------

    package Stop_Condition_Rule is
        function  Premiss return F_Kbs.Kbs.Fact_Queries;
        procedure Action (Objects : F_Kbs.Kbs.Fact_Collection);
    end Stop_Condition_Rule;

    package body Stop_Condition_Rule is

        function Premiss return F_Kbs.Kbs.Fact_Queries is
        begin
            return (1 => (Factorials.Exist ((Number  => Is_Equal (1),
                                             Value   => Is_Undefined,
                                             Message => Is_Any))));
        end Premiss;


        procedure Action (Objects : F_Kbs.Kbs.Fact_Collection) is
            The_Fact : F_Kbs.Kbs.Fact_Name renames Objects (1);
            use Output_Stream;
        begin  
            New_Line (Standard_Output);
            Put_Line ("---- Stop condition rule -----", Standard_Output);
            --New_Line (Standard_Output);
            --Put ("Modifying : ", Standard_Output);
            --Put (The_Fact, Standard_Output);
            Factorials.Change (The_Fact, Value, Slot.Value (1));
            Factorials.Change (The_Fact, Message, Slot.Value ("Hello world"));
            New_Line (Standard_Output);
            --Put ("Becomes : ", Standard_Output);
            --F_Frames.Put (The_Fact, Standard_Output);
            --New_Line (Standard_Output);
            --New_Line (Standard_Output);
        end Action;

    end Stop_Condition_Rule;



    ---------------------------------------------------------------------------

    package Resolve_Sub_Goals_Rule is
        function  Premiss return F_Kbs.Kbs.Fact_Queries;
        procedure Action (Objects : F_Kbs.Kbs.Fact_Collection);
    end Resolve_Sub_Goals_Rule;

    package body Resolve_Sub_Goals_Rule is

        function Premiss return F_Kbs.Kbs.Fact_Queries is  
        begin
            return (Factorials.Exist
                       ((Number  => Define_As (N),  
                         Value   => Is_Defined,
                         Message => Is_Equal
                                       (Value ("Hello ") & Value ("world")))),
                    Factorials.Exist ((Number  => Is_Equal  
                                                     (Value (N) + Value (1)),
                                       Value   => Is_Undefined,
                                       Message => Is_Any)),
                    Factorials.Not_Any ((Number  => Is_Less (N),
                                         Value   => Is_Undefined,
                                         Message => Is_Any)));
        end Premiss;


        procedure Action (Objects : F_Kbs.Kbs.Fact_Collection) is
            The_Known_Fact : F_Kbs.Kbs.Fact_Name renames Objects (1);
            The_Unknown_Fact : F_Kbs.Kbs.Fact_Name renames Objects (2);
            The_Number : Slot.Object := F_Frames.Factorials.Get
                                           (The_Unknown_Fact, F_Frames.Number);
            The_Value : Slot.Object := F_Frames.Factorials.Get
                                          (The_Known_Fact, F_Frames.Value);
            use Output_Stream;  
            use Slot.Operators;
        begin
            New_Line (Standard_Output);
            Put_Line ("---- Resolve sub-goals rule -----", Standard_Output);
            New_Line (Standard_Output);
            --Put ("Modifying : ", Standard_Output);
            --Put (The_Unknown_Fact, Standard_Output);
            Factorials.Change (The_Unknown_Fact, Value, The_Number * The_Value);
            Factorials.Change (The_Unknown_Fact, Message,
                               Value ("Hello world"));
            New_Line (Standard_Output);
            --Put ("Becomes : ", Standard_Output);
            --F_Frames.Put (The_Unknown_Fact, Standard_Output);
            New_Line (Standard_Output);
            --Put ("Deleting: ", Standard_Output);
            --F_Frames.Put (The_Known_Fact, Standard_Output);
            --F_Frames.Factorials.Delete (The_Known_Fact);
        end Action;

    end Resolve_Sub_Goals_Rule;



    ---------------------------------------------------------------------------

    package Make_Sub_Goals_Rule is
        function  Premiss return F_Kbs.Kbs.Fact_Queries;
        procedure Action (Objects : F_Kbs.Kbs.Fact_Collection);
    end Make_Sub_Goals_Rule;

    package body Make_Sub_Goals_Rule is

        function Premiss return F_Kbs.Kbs.Fact_Queries is
        begin
            return (Factorials.Exist ((Number  => Define_As (N),
                                       Value   => Is_Undefined,
                                       Message => Is_Any)),
                    Factorials.Not_Any
                       ((Number  => Is_Equal ((Value (N) - Value (1))),
                         Value   => Is_Any,
                         Message => Is_Any)));
        end Premiss;


        procedure Action (Objects : F_Kbs.Kbs.Fact_Collection) is
            use Output_Stream;
            The_Fact   : F_Kbs.Kbs.Fact_Name renames Objects (1);
            The_Number : Integer := F_Frames.Factorials.Get
                                       (The_Fact, F_Frames.Number);
        begin
            New_Line (Standard_Output);
            Put_Line ("---- Make sub-goals rule -----", Standard_Output);
            New_Line (Standard_Output);
            --Put ("Creating : ", Standard_Output);
            The_Number := The_Number - 1;
            Factorials.Add ((Value (The_Number), Undefined_Value, Value (" ")));
            --New_Line (Standard_Output);
        end Action;

    end Make_Sub_Goals_Rule;

    ---------------------------------------------------------------------------

    package Rule_Bundle is new F_Kbs.Kbs.Rule_Base.Generic_Rule_Bundle
                                  (The_Bundle => F_Kbs.F_Bundle,
                                   Rule_Names => Rule_Names,
                                   Nothing    => Rule_Names'Last,
                                   Rule_1     => Stop_Condition,
                                   Premiss_1  => Stop_Condition_Rule.Premiss,
                                   Action_1   => Stop_Condition_Rule.Action,

                                   Rule_2     => Resolve_Sub_Goals,
                                   Premiss_2  => Resolve_Sub_Goals_Rule.Premiss,
                                   Action_2   => Resolve_Sub_Goals_Rule.Action,

                                   Rule_3     => Make_Sub_Goals,
                                   Premiss_3  => Make_Sub_Goals_Rule.Premiss,
                                   Action_3   => Make_Sub_Goals_Rule.Action);

    procedure Do_Action (For_Rule : F_Kbs.Kbs.Rule_Id;
                         On_Facts : F_Kbs.Kbs.Fact_Collection) is
    begin
        Rule_Bundle.Do_Action (For_Rule, On_Facts);
    end Do_Action;
end F_General_Bundle;

E3 Meta Data

    nblk1=f
    nid=9
    hdr6=12
        [0x00] rec0=20 rec1=00 rec2=01 rec3=088
        [0x01] rec0=01 rec1=00 rec2=02 rec3=022
        [0x02] rec0=1a rec1=00 rec2=0b rec3=03c
        [0x03] rec0=15 rec1=00 rec2=05 rec3=030
        [0x04] rec0=12 rec1=00 rec2=0a rec3=038
        [0x05] rec0=19 rec1=00 rec2=04 rec3=006
        [0x06] rec0=16 rec1=00 rec2=07 rec3=03c
        [0x07] rec0=14 rec1=00 rec2=0e rec3=084
        [0x08] rec0=0d rec1=00 rec2=0d rec3=000
        [0x09] rec0=0a rec1=00 rec2=0d rec3=000
        [0x0a] rec0=10 rec1=00 rec2=04 rec3=000
        [0x0b] rec0=0e rec1=00 rec2=02 rec3=000
        [0x0c] rec0=0e rec1=00 rec2=02 rec3=000
        [0x0d] rec0=07 rec1=00 rec2=06 rec3=000
        [0x0e] rec0=00 rec1=00 rec2=00 rec3=019
    tail 0x21737f046850940e428d4 0x42a00088462063c03
Free Block Chain:
  0x9: 0000  00 0c 03 fc 80 4a 20 20 20 20 20 20 20 20 46 61  ┆     J        Fa┆
  0xc: 0000  00 0f 00 04 80 01 20 01 02 03 04 05 06 07 08 09  ┆                ┆
  0xf: 0000  00 03 01 63 80 14 6f 6c 76 65 5f 53 75 62 5f 47  ┆   c  olve_Sub_G┆
  0x3: 0000  00 06 00 05 80 02 61 74 02 03 74 05 06 74 08 09  ┆      at  t  t  ┆
  0x6: 0000  00 08 00 ef 00 36 20 20 20 20 70 72 6f 63 65 64  ┆     6    proced┆
  0x8: 0000  00 00 00 f0 80 1c 65 20 28 31 29 2c 20 41 6c 69  ┆      e (1), Ali┆