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

⟦785b36266⟧ Ada Source

    Length: 8192 (0x2000)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Put_New_Tower_On_Table_Rule, seg_04baf8, separate Decision_System_2.Fruit_Rule_Bundle

Derivation

└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000
    └─ ⟦cfc2e13cd⟧ »Space Info Vol 2« 
        └─⟦this⟧ 

E3 Source Code



separate (Decision_System_2.Fruit_Rule_Bundle)

package body Put_New_Tower_On_Table_Rule is

    function Premiss return Fact_Queries is
        use Fruit_Frames;
    begin
        return (Markers.Exist ((Name => Is_Equal (Top_Block_Marker_Name))),
                Markers.Exist ((Name => Is_Equal (Selected_Block_Marker_Name))),
                Markers.Exist ((Name => Is_Equal (Model_Marker_Name))),
                Markers.Absent ((Name => Is_Equal
                                            (Top_Copied_Model_Marker_Name))));
    end Premiss;


    procedure Action (Objects : Fact_Collection) is
        use Visual_System_2;
        use Fruit_Frames;
        The_Label             : Labels;
        Moving_Possible       : Boolean := True;  
        Top_Block_Marker      : Fact_Name renames Objects (1);
        Selected_Block_Marker : Fact_Name renames Objects (2);
        Model_Marker          : Fact_Name renames Objects (3);

        subtype Bottom_Top is Directions range Up .. Down;
        subtype Left_Right is Directions range Right .. Left;

        procedure Place_Marker (What_Marker : Marker_Ids;
                                On          : Bottom_Top;
                                And_On      : Left_Right) is
        begin  
            Moving_Possible := True;
            while Moving_Possible loop
                Moving_Possible := Move (What_Marker, On);
            end loop;  
            Moving_Possible := True;
            while Moving_Possible loop
                Moving_Possible := Move (What_Marker, And_On);
            end loop;
        end Place_Marker;

        procedure Search_Next_Block_In_Model is
        begin
            Moving_Possible := True;  
            Moving_Possible := Move (Model_Marker_Id, Up);

            if (Get_Label (Model_Marker_Id) = Null_Label) or
               (not Moving_Possible) then
                -- le modele a copier est fini
                Markers.Delete (Model_Marker);
            end if;
        end Search_Next_Block_In_Model;

        procedure Move_Top_Block_On_Free_Place is
        begin  
            Moving_Possible := True;
            while (Get_Label (On_Table_Marker_Id) /= Null_Label) and
                     Moving_Possible loop
                Moving_Possible := Move (On_Table_Marker_Id, Left);
            end loop;

            if not Moving_Possible then
                -- no free place on table : search on next level
                --search from right to left
                Moving_Possible := Move (On_Table_Marker_Id, Up);
                Moving_Possible := True;
                while Moving_Possible loop
                    Moving_Possible := Move (On_Table_Marker_Id, Right);
                end loop;

                --recursive search: possible only if there is a free place
                --available in the environment
                Move_Top_Block_On_Free_Place;

            else

                Put_Block (Block_Marked_With_Id    => Top_Block_Marker_Id,
                           On_Marked_Place_With_Id => On_Table_Marker_Id);
                Markers.Delete (Top_Block_Marker);
            end if;
        end Move_Top_Block_On_Free_Place;

    begin  
        if Is_Same (Selected_Block_Marker_Id, Top_Block_Marker_Id) then
            -- the first selected block is on the top of a stack

            Place_Marker
               (Top_Copied_Model_Marker_Id, On => Down, And_On => Left);

            Moving_Possible := True;
            loop --search for a free place on table
                The_Label := Get_Label (Top_Copied_Model_Marker_Id);
                exit when The_Label = Null_Label;
                Moving_Possible := Move (Top_Copied_Model_Marker_Id, Right);
                exit when Moving_Possible = False;
            end loop;

            if not Moving_Possible then
                -- STOP
                Markers.Delete (Model_Marker);
            else

                Markers.Add ((Name => Top_Copied_Model_Marker_Name));

                Put_Block (Block_Marked_With_Id    => Selected_Block_Marker_Id,
                           On_Marked_Place_With_Id =>
                              Top_Copied_Model_Marker_Id);

                Protecte_Column (Top_Copied_Model_Marker_Id);

                Markers.Delete (Top_Block_Marker);
                Markers.Delete (Selected_Block_Marker);
                Search_Next_Block_In_Model;

            end if;
        else
            -- first the top of the stack must be moved away until the
            -- selected block is on the top

            -- to search a free place on table begin at bottom right
            Place_Marker (On_Table_Marker_Id, On => Down, And_On => Right);

            -- search a free place on table
            Move_Top_Block_On_Free_Place;

        end if;  
    end Action;


end Put_New_Tower_On_Table_Rule;

E3 Meta Data

    nblk1=7
    nid=0
    hdr6=e
        [0x00] rec0=1a rec1=00 rec2=01 rec3=038
        [0x01] rec0=00 rec1=00 rec2=02 rec3=008
        [0x02] rec0=19 rec1=00 rec2=06 rec3=034
        [0x03] rec0=19 rec1=00 rec2=05 rec3=018
        [0x04] rec0=0d rec1=00 rec2=04 rec3=03c
        [0x05] rec0=19 rec1=00 rec2=07 rec3=000
        [0x06] rec0=13 rec1=00 rec2=03 rec3=000
    tail 0x21750cb1e86844bf7bb36 0x42a00088462063c03