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

⟦880925293⟧ TextFile

    Length: 3486 (0xd9e)
    Types: TextFile
    Names: »B«

Derivation

└─⟦a7d1ea751⟧ Bits:30000550 8mm tape, Rational 1000, !users!projects 94_04_11
    └─ ⟦129cab021⟧ »DATA« 
        └─⟦this⟧ 

TextFile

with Action;
with Role;
with Station_Identifier;
with Step;
with Text_Io;
with Time;
package body Moteur is

    task type Station is
        entry Set_Info (The_Time : Time.Object; The_Action : Action.Object);
        entry Go;
    end Station;

    type Pstation is access Station;

    type Set_Of_Stations is
       array (Station_Identifier.Object (1) ..
                 Station_Identifier.Object (250)) of Pstation;

    Max_Station_Id : Station_Identifier.Object;

    My_Station : Set_Of_Stations;

    task body Station is
        The_Role : Role.Object;
        Exec_Request : Boolean := False;
        Total_Time : Time.Object;
        Next_Operation_Time : Duration;
        use Time;
    begin
        loop
            select
                accept Set_Info (The_Time : Time.Object;
                                 The_Action : Action.Object) do
                    Role.Put_Action (The_Role, The_Time, The_Action);
                end Set_Info;
            or
                accept Go do
                    Exec_Request := True;
                end Go;
            end select;
            exit when Exec_Request = True;
        end loop;
        if Exec_Request = True then
            Total_Time := 0.0;
            Role.Prepare (The_Role);
            while not Role.Is_At_End (The_Role) loop
                declare
                    Local_Time : Time.Object;
                    Local_Action : Action.Object;
                begin
                    Role.Get_Next_Action (The_Role, Local_Time, Local_Action);
                    Next_Operation_Time :=
                       Duration (Local_Time) - Duration (Total_Time);
                    delay Next_Operation_Time;
                    Text_Io.Put_Line (Action.Image (Local_Action));
                    Total_Time := Local_Time;
                end;
            end loop;
        end if;
    end Station;


    procedure Open (Nom : String; The_File : in out Text_Io.File_Type) is
        M : Text_Io.File_Mode := Text_Io.In_File;
    begin
        Text_Io.Open (File => The_File, Mode => M, Name => Nom, Form => "");
    end Open;

    procedure Close (The_File : in out Text_Io.File_Type) is
    begin
        Text_Io.Close (The_File);
    end Close;



    procedure Init (The_File : String) is
        The_Station_Id : Station_Identifier.Object;
        The_Time : Time.Object;  
        The_Action : Action.Object;
        The_Spectacle : Text_Io.File_Type;
        use Station_Identifier;
    begin
        Open (The_File, The_Spectacle);  
        Max_Station_Id := Station_Identifier.Get_From_File (The_Spectacle);
        Text_Io.Skip_Line (The_Spectacle);
        for I in 1 .. Max_Station_Id loop
            My_Station (I) := new Station;
        end loop;

        while not Text_Io.End_Of_File (The_Spectacle) loop
            The_Station_Id := Station_Identifier.Get_From_File (The_Spectacle);
            The_Time := Time.Get_From_File (The_Spectacle);

            The_Action := Action.Get_From_File (The_Spectacle);
            if The_Station_Id > Max_Station_Id then
                Text_Io.Put_Line ("Trop grand");
            else
                My_Station (The_Station_Id).Set_Info (The_Time, The_Action);
            end if;

            Text_Io.Skip_Line (The_Spectacle);
        end loop;
        Close (The_Spectacle);
    end Init;

    procedure Go is
    begin
        for I in 1 .. Max_Station_Id loop
            My_Station (I).Go;
        end loop;
    end Go;

end Moteur;