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

⟦d0ae90170⟧ TextFile

    Length: 8232 (0x2028)
    Types: TextFile
    Names: »B«

Derivation

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

TextFile

with Action;
with Element;
with Station_Identifier;
with String_Utilities;
with Text_Io;
with My_Time;
package body Trame_Product is

    type Destination is (Screen, File);
    The_Destination : Destination;
    File_Dest : Text_Io.File_Type;

    Value_Size : constant := 4;

    procedure Choose_The_Destination is

        function Read_String return String is
            C : Character;
        begin
            if Text_Io.End_Of_Line then
                return "";
            else
                Text_Io.Get (C);
                return C & Read_String;
            end if;
        end Read_String;

    begin
        Text_Io.Put_Line
           ("Entrez le fichier de destination :  ( {} = screen )");
        declare
            File_Name : constant String := Read_String;
            M : Text_Io.File_Mode := Text_Io.Out_File;
        begin
            if File_Name'Length = 0 then
                The_Destination := Screen;
            else
                The_Destination := File;
                Text_Io.Create (File => File_Dest,
                                Mode => M,
                                Name => File_Name,
                                Form => "");
            end if;
        end;
    end Choose_The_Destination;


    function Convert_To_Decimal
                (The_Adress_Station : Element.Adress) return Element.Adress is
        Inter : Integer;
        Succes : Boolean;
    begin
        String_Utilities.String_To_Number
           (String (The_Adress_Station), Inter, Succes, 16);  
        return String_Utilities.Number_To_String
                  (Value => Inter, Base => 10, Width => 2, Leading => '0')
                  (1 .. 2);
    end Convert_To_Decimal;


    function Format_Value
                (The_Value : Natural; The_Format : Natural) return String is
    begin
        return String_Utilities.Number_To_String (Value => The_Value,
                                                  Base => 10,
                                                  Width => The_Format,
                                                  Leading => '0');
    end Format_Value;


    procedure Write_Activate (The_Station : Station_Identifier.Object;
                              The_Adress_Station : Element.Adress;
                              The_Time : Natural;
                              The_Acteur : Element.Num_Acteur) is
    begin
        if The_Destination = Screen then
            Station_Identifier.Set_To_Screen (The_Station);
            My_Time.Set_To_Screen (My_Time.Convert_To (The_Time));
        else
            Station_Identifier.Set_To_File (The_Station, File_Dest);
            My_Time.Set_To_File (My_Time.Convert_To (The_Time), File_Dest);
        end if;

        declare
            Trame : constant String :=
               ' ' & 'D' & Convert_To_Decimal (The_Adress_Station) &
                  String_Utilities.Number_To_String (Value => The_Acteur,
                                                     Base => 10,
                                                     Width => 2,
                                                     Leading => '0') &
                  "0001" & 'F';
        begin
            if The_Destination = Screen then
                Action.Set_To_Screen (Action.Convert_To (Trame));
            else
                Action.Set_To_File (File_Dest, Action.Convert_To (Trame));
            end if;
        end;
    end Write_Activate;


    procedure Write_Desactivate (The_Station : Station_Identifier.Object;
                                 The_Adress_Station : Element.Adress;
                                 The_Time : Natural;
                                 The_Acteur : Element.Num_Acteur) is
    begin
        if The_Destination = Screen then
            Station_Identifier.Set_To_Screen (The_Station);
            My_Time.Set_To_Screen (My_Time.Convert_To (The_Time));
        else
            Station_Identifier.Set_To_File (The_Station, File_Dest);
            My_Time.Set_To_File (My_Time.Convert_To (The_Time), File_Dest);
        end if;
        declare
            Trame : constant String :=
               ' ' & 'D' & Convert_To_Decimal (The_Adress_Station) &
                  String_Utilities.Number_To_String (Value => The_Acteur,
                                                     Base => 10,
                                                     Width => 2,
                                                     Leading => '0') &
                  "0000" & 'F';
        begin
            if The_Destination = Screen then
                Action.Set_To_Screen (Action.Convert_To (Trame));
            else
                Action.Set_To_File (File_Dest, Action.Convert_To (Trame));
            end if;
        end;
    end Write_Desactivate;


    procedure Write_Change (The_Station : Station_Identifier.Object;
                            The_Adress_Station : Element.Adress;
                            The_Time : Natural;
                            The_Acteur : Element.Num_Acteur;
                            The_Value : Natural) is
    begin
        if The_Destination = Screen then
            Station_Identifier.Set_To_Screen (The_Station);
            My_Time.Set_To_Screen (My_Time.Convert_To (The_Time));
        else
            Station_Identifier.Set_To_File (The_Station, File_Dest);
            My_Time.Set_To_File (My_Time.Convert_To (The_Time), File_Dest);
        end if;
        declare
            Trame : constant String :=
               ' ' & 'D' & Convert_To_Decimal (The_Adress_Station) &
                  String_Utilities.Number_To_String (Value => The_Acteur,
                                                     Base => 10,
                                                     Width => 2,
                                                     Leading => '0') &
                  Format_Value (The_Value, Value_Size) & 'F';
        begin
            if The_Destination = Screen then
                Action.Set_To_Screen (Action.Convert_To (Trame));
            else
                Action.Set_To_File (File_Dest, Action.Convert_To (Trame));
            end if;
        end;
    end Write_Change;


    procedure Write_Evoluate (The_Station : Station_Identifier.Object;
                              The_Adress_Station : Element.Adress;
                              The_Time : Natural;
                              The_Acteur : Element.Num_Acteur;
                              The_Value : Natural;
                              The_Duration : Natural) is
    begin
        if The_Destination = Screen then
            Station_Identifier.Set_To_Screen (The_Station);
            My_Time.Set_To_Screen (My_Time.Convert_To (The_Time));
        else
            Station_Identifier.Set_To_File (The_Station, File_Dest);
            My_Time.Set_To_File (My_Time.Convert_To (The_Time), File_Dest);
        end if;
        declare
            Trame : constant String :=
               ' ' & 'D' & Convert_To_Decimal (The_Adress_Station) &
                  String_Utilities.Number_To_String (Value => The_Acteur,
                                                     Base => 10,
                                                     Width => 2,
                                                     Leading => '0') &
                  Format_Value (The_Value, Value_Size) &
                  Format_Value (The_Duration, Value_Size) & 'F';
        begin
            if The_Destination = Screen then
                Action.Set_To_Screen (Action.Convert_To (Trame));
            else
                Action.Set_To_File (File_Dest, Action.Convert_To (Trame));
            end if;
        end;
    end Write_Evoluate;


    procedure Write_Number_Of_Station
                 (The_Number : Station_Identifier.Object) is
    begin
        if The_Destination = Screen then
            Station_Identifier.Set_To_Screen (The_Number);
            Text_Io.Put_Line ("");
        else
            Station_Identifier.Set_To_File (The_Number, File_Dest);
            Text_Io.Put_Line (File_Dest, "");
        end if;
    end Write_Number_Of_Station;


    procedure Done is
    begin
        if The_Destination = File then
            Text_Io.Close (File_Dest);
        end if;
    end Done;

end Trame_Product;