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

⟦a3f842f7e⟧ Ada Source

    Length: 9216 (0x2400)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Put_Block_On_New_Tower_Rule, seg_04bbe4, separate Decision_System.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.Fruit_Rule_Bundle)

package body Put_Block_On_New_Tower_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
                                           (Top_Copied_Model_Marker_Name))),
                Markers.Exist ((Name => Is_Equal (Model_Marker_Name))));
    end Premiss;


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

        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
                -- the model has been copied
                Markers.Delete (Model_Marker);
            end if;
        end Search_Next_Block_In_Model;


        procedure Place_On_Table_Marker_On_The_Bottom_Right is
        begin
            Moving_Possible := True;
            while Moving_Possible loop
                Moving_Possible := Move (On_Table_Marker_Id, Down);
            end loop;
            Moving_Possible := True;
            while Moving_Possible loop
                Moving_Possible := Move (On_Table_Marker_Id, Right);
            end loop;
        end Place_On_Table_Marker_On_The_Bottom_Right;


        procedure Move_To_Next_Place is
        begin
            Moving_Possible := True;
            Moving_Possible := Move (On_Table_Marker_Id, Left);
            if not Moving_Possible then
                -- go on upper level
                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;
            end if;
        end Move_To_Next_Place;


        function Is_Table_Marker
                    (In_Column_Marked_With : Marker_Ids) return Boolean is
            Level     : Integer := 0;
            Moving    : Boolean := True;  
            In_Column : Boolean := False;
        begin  
            while Moving loop  
                if Is_Same (In_Column_Marked_With, On_Table_Marker_Id)  
                    then
                    In_Column := True;
                end if;
                Moving := Move (On_Table_Marker_Id, Down);  
                Level  := Level + 1;
            end loop;

            --replace on_table_marker on initial place
            for I in 1 .. Level - 1 loop
                Moving := Move (On_Table_Marker_Id, Up);
            end loop;

            return In_Column;
        end Is_Table_Marker;


        procedure Move_Top_Block_On_Free_Place is  
            Moving_Down : Boolean := True;
        begin  
            while (Get_Label (On_Table_Marker_Id) /= Null_Label) loop
                Move_To_Next_Place;
            end loop;


            -- is the free block in the column where the selected_block is ?
            if Is_Table_Marker (In_Column_Marked_With =>
                                   Top_Block_Marker_Id) then
                Move_To_Next_Place;
                Move_Top_Block_On_Free_Place;  
            elsif Is_Table_Marker (In_Column_Marked_With =>
                                      Top_Copied_Model_Marker_Id) then
                --the free block is on the copied_model top : search another free place
                Move_To_Next_Place;
                Move_Top_Block_On_Free_Place;  
            else
                -- have found a free place
                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
            -- when the selected block is on the top of a stack

            Put_Block (Block_Marked_With_Id    => Selected_Block_Marker_Id,
                       On_Marked_Place_With_Id => Top_Copied_Model_Marker_Id);
            Moving_Possible := Move (Top_Copied_Model_Marker_Id, Up);

            Markers.Delete (Selected_Marker);
            Markers.Delete (Top_Block_Marker);

            Search_Next_Block_In_Model;

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

            -- to search a free place:place first table_marker on bottom right
            -- of the table
            Place_On_Table_Marker_On_The_Bottom_Right;

            -- move top block on free place (because selected block is not on top)
            Move_Top_Block_On_Free_Place;

        end if;
    end Action;


end Put_Block_On_New_Tower_Rule;

E3 Meta Data

    nblk1=8
    nid=3
    hdr6=c
        [0x00] rec0=18 rec1=00 rec2=01 rec3=068
        [0x01] rec0=1d rec1=00 rec2=05 rec3=046
        [0x02] rec0=1a rec1=00 rec2=06 rec3=032
        [0x03] rec0=1b rec1=00 rec2=07 rec3=064
        [0x04] rec0=17 rec1=00 rec2=08 rec3=042
        [0x05] rec0=14 rec1=00 rec2=04 rec3=000
        [0x06] rec0=1b rec1=00 rec2=04 rec3=00a
        [0x07] rec0=05 rec1=00 rec2=03 rec3=001
    tail 0x21750e63a868940c07eb2 0x42a00088462063c03
Free Block Chain:
  0x3: 0000  00 02 02 44 80 09 5f 4d 61 72 6b 65 72 29 3b 09  ┆   D  _Marker); ┆
  0x2: 0000  00 00 02 2f 80 43 65 20 66 72 65 65 20 62 6c 6f  ┆   / Ce free blo┆