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

⟦5210c35b7⟧ Ada Source

    Length: 11264 (0x2c00)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Moteur, seg_038051

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



with Personnal_Array;  
with Personnal_String;
with Element_De_Tri;
with Text_Io;
with Serial_Io;
package body Moteur is  
    type Pstring is access String;
    type Tableau_D_Element_De_Tri is array (1 .. 1000) of Element_De_Tri.Object;
    type Table_De_Tri is
        record
            The_Tab : Tableau_D_Element_De_Tri;
            Size : Natural;
        end record;

    Time_Max : constant Duration := 86400.0;
    The_File : Text_Io.File_Type;
    Base : Duration;
    The_Tab : Personnal_Array.Object;

    procedure File_Open (The_Name : String; Mode : Text_Io.File_Mode) is

    begin
        Text_Io.Open
           (File => The_File, Mode => Mode, Name => The_Name, Form => "");
    end File_Open;


    procedure File_Close is

    begin
        Text_Io.Close (The_File);
    end File_Close;


    procedure Start_Chrono is

    begin
        Base := 0.0;
    end Start_Chrono;


    function Current_Time_Is_Over (A_Time : Duration) return Boolean is

    begin
        delay A_Time - Base;
        Base := A_Time;
        return True;
    end Current_Time_Is_Over;


    function File_Time_Value (A_File : Text_Io.File_Type) return Duration is
        A_String : Personnal_String.Object;
        C : Character;

    begin
        Personnal_String.Raz (A_String);
        if not Text_Io.End_Of_File (A_File) then
            Text_Io.Get (A_File, C);  
            while C = ' ' loop
                Text_Io.Get (A_File, C);
            end loop;
            while C in '0' .. '9' loop
                Personnal_String.Put (A_String, C);
                Text_Io.Get (A_File, C);
            end loop;
            return
               Duration ((Integer'Value (Personnal_String.Value (A_String)))) /
                  10;
        else
            return Time_Max;
        end if;
    end File_Time_Value;


    function File_Length (A_File : Text_Io.File_Type)
                         return Text_Io.Positive_Count is
        C : Character;
    begin
        while not Text_Io.End_Of_File (A_File) loop
            Text_Io.Get (A_File, C);
        end loop;  
        return Text_Io.Line (A_File);
    end File_Length;


    procedure Line_Put (A_File : Text_Io.File_Type) is
        C : Character;
        A_String : Personnal_String.Object;

    begin
        Personnal_String.Raz (A_String);
        while not Text_Io.End_Of_File (A_File) and
                 not Text_Io.End_Of_Line (A_File) loop
            Text_Io.Get (A_File, C);
            if C /= ' ' then
                Personnal_String.Put (A_String, C);
            end if;  
        end loop;  
        Personnal_Array.Put (The_Tab, A_String);
    end Line_Put;


    procedure Send_To_Serial_Io (The_String : String) is

    begin  
        Serial_Io.Put (S => "D", Tty => "/dev/tty0");
        Serial_Io.Put (S => The_String, Tty => "/dev/tty0");       Serial_Io.Put ("F", Tty => "/dev/tty0");
    end Send_To_Serial_Io;



    procedure Send is

    begin
        for I in 1 .. Personnal_Array.Last (The_Tab) loop
            declare
                Tmp : Pstring;
            begin
                Tmp := new String'(Personnal_Array.Value (The_Tab, I));
                Send_To_Serial_Io (Tmp.all);
            end;
        end loop;
    end Send;


    procedure Copy_File_Into_Tab (A_File : Text_Io.File_Type;
                                  Une_Table : in out Table_De_Tri) is

    begin
        for I in 1 .. Une_Table.Size loop
            if not Text_Io.End_Of_File (A_File) then
                Element_De_Tri.Affecter (Une_Table.The_Tab (I),
                                         File_Time_Value (A_File));
                Element_De_Tri.Affecter (Une_Table.The_Tab (I), A_File);
            end if;
        end loop;
    end Copy_File_Into_Tab;

    procedure Copy_Tab_Into_File (A_File : in out Text_Io.File_Type;
                                  Une_Table : Table_De_Tri) is

    begin
        for I in 1 .. Une_Table.Size loop
            Text_Io.Put
               (A_File,
                Integer'Image
                   (Integer
                       (Element_De_Tri.Temps_Value (Une_Table.The_Tab (I)) *
                        10)));
            Text_Io.Put (A_File, "  ");
            Text_Io.Put_Line (A_File, Element_De_Tri.Contenu_Value
                                         (Une_Table.The_Tab (I)));
        end loop;
    end Copy_Tab_Into_File;

    procedure Tri_A_Bulle (Une_Table : in out Table_De_Tri) is
        J : Integer;
        Tmp : Element_De_Tri.Object;
    begin
        for I in 1 .. Une_Table.Size - 1 loop
            J := Une_Table.Size;
            while J >= I + 1 loop
                if Element_De_Tri.Temps_Value (Une_Table.The_Tab (J)) <
                   Element_De_Tri.Temps_Value (Une_Table.The_Tab (J - 1)) then
                    Tmp := Une_Table.The_Tab (J);
                    Une_Table.The_Tab (J) := Une_Table.The_Tab (J - 1);
                    Une_Table.The_Tab (J - 1) := Tmp;
                end if;  
                J := J - 1;
            end loop;
        end loop;
    end Tri_A_Bulle;

    function Trier (In_File : String) return String is
        La_Table : Table_De_Tri;

    begin
        File_Open (In_File, Text_Io.In_File);
        La_Table.Size := Positive (File_Length (The_File));
        File_Close;
        File_Open (In_File, Text_Io.In_File);  
        Copy_File_Into_Tab (The_File, La_Table);
        File_Close;
        Tri_A_Bulle (La_Table);
        Text_Io.Create (File => The_File,
                        Mode => Text_Io.Out_File,
                        Name => In_File & ".tri",
                        Form => "");  
        Copy_Tab_Into_File (The_File, La_Table);
        File_Close;
        return In_File & ".tri";
    end Trier;

    procedure Run (Name : String) is
        Current_File_Time, The_Time : Duration;

    begin  
        File_Open (Name, Text_Io.In_File);
        Start_Chrono;
        Current_File_Time := File_Time_Value (The_File);
        The_Time := Current_File_Time;
        while not Text_Io.End_Of_File (The_File) loop
            Personnal_Array.Raz (The_Tab);
            while The_Time <= Current_File_Time loop
                Line_Put (The_File);
                Text_Io.Skip_Line (The_File);
                The_Time := File_Time_Value (The_File);
            end loop;  
            if Current_Time_Is_Over (Current_File_Time) then
                Send;
                Current_File_Time := The_Time;
            end if;
        end loop;  
        File_Close;
    end Run;

end Moteur;

E3 Meta Data

    nblk1=a
    nid=8
    hdr6=e
        [0x00] rec0=2b rec1=00 rec2=01 rec3=046
        [0x01] rec0=22 rec1=00 rec2=09 rec3=006
        [0x02] rec0=20 rec1=00 rec2=05 rec3=002
        [0x03] rec0=1e rec1=00 rec2=06 rec3=032
        [0x04] rec0=1b rec1=00 rec2=03 rec3=02e
        [0x05] rec0=1a rec1=00 rec2=04 rec3=01a
        [0x06] rec0=1c rec1=00 rec2=07 rec3=000
        [0x07] rec0=1d rec1=00 rec2=07 rec3=000
        [0x08] rec0=1d rec1=00 rec2=07 rec3=001
        [0x09] rec0=d5 rec1=09 rec2=a4 rec3=608
    tail 0x217359db684e66dc5bf0f 0x42a00088462060003
Free Block Chain:
  0x8: 0000  00 02 00 04 80 01 61 01 02 03 04 05 06 07 08 09  ┆      a         ┆
  0x2: 0000  00 0a 00 08 80 05 6e 67 65 20 6c 05 20 20 20 20  ┆      nge l     ┆
  0xa: 0000  00 00 00 0a 80 07 65 72 20 28 41 5f 54 07 08 09  ┆      er (A_T   ┆