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

⟦f44a07755⟧ TextFile

    Length: 5236 (0x1474)
    Types: TextFile
    Names: »B«

Derivation

└─⟦5f3412b64⟧ Bits:30000745 8mm tape, Rational 1000, ENVIRONMENT 12_6_5 TOOLS 
    └─ ⟦91c658230⟧ »DATA« 
        └─⟦458657fb6⟧ 
            └─⟦274c33adf⟧ 
└─⟦d10a02448⟧ Bits:30000409 8mm tape, Rational 1000, ENVIRONMENT, D_12_7_3
    └─ ⟦fc9b38f02⟧ »DATA« 
        └─⟦9b46a407a⟧ 
            └─⟦274c33adf⟧ 
                └─⟦this⟧ 

TextFile

with Debug_Tools;
with Error_Reporting;
with Io;
with Program;
with Simple_Status;
with String_Utilities;
with System_Utilities;

procedure Initialize_Cross_Compilers is

    File_Name : constant String := "!Machine.Cross_Compilers";
    File : Io.File_Type;

    procedure Close is
    begin
        Io.Close (File);
    exception
        when others =>
            null;
    end Close;

    function Get_First_Token (From : String) return String is
    begin
        for Index in From'Range loop
            if From (Index) = ' ' then
                return From (From'First .. Index - 1);
            end if;
        end loop;
        return From;
    end Get_First_Token;

    function Get_Remainder (From : String) return String is
    begin
        for Index in From'Range loop
            if From (Index) = ' ' then
                return From (Index + 1 .. From'Last);
            end if;
        end loop;
        return "";
    end Get_Remainder;

    procedure Start_Compiler (Target_Entry : String) is  
        Target_Name : constant String := Get_First_Token (Target_Entry);
        Params : constant String := Get_Remainder (Target_Entry);

        Caller : constant String :=
           "!Machine.Initialize_Cross_Compilers." & Target_Name;

        Context : constant String := "!Targets.Implementation.";
        Routine : constant String := "Start_Compiler";  
        Activity : constant String := "!Machine.Release.Current.Activity";
        Job_Id : Program.Job_Id;
        Status : Program.Condition;

        procedure Await_Elaboration is
        begin  
            if not Program.Started_Successfully (Status) then
                Error_Reporting.Report_Error
                   (Caller => Caller,
                    Reason => Error_Reporting.Create_Condition_Name
                                 ("Unable to start compiler",
                                  Error_Reporting.Problem),
                    Explanation => Simple_Status.Display_Message (Status));
            end if;

            for I in 1 .. 100 loop
                begin
                    declare
                        Name : constant String :=
                           System_Utilities.Job_Name (Job_Id);
                    begin  
                        if Name'First =
                           String_Utilities.Locate (Fragment => Target_Name,
                                                    Within => Name,
                                                    Ignore_Case => True) then
                            return;
                        end if;
                        delay 5.0;
                    end;
                exception
                    when others =>
                        Error_Reporting.Report_Error
                           (Caller => Caller,
                            Reason => Error_Reporting.Create_Condition_Name
                                         ("Cannot get compiler job name",
                                          Error_Reporting.Problem),
                            Explanation =>
                               Debug_Tools.Get_Exception_Name (True, True));
                        return;
                end;
            end loop;

            Error_Reporting.Report_Error
               (Caller => Caller,
                Reason => Error_Reporting.Create_Condition_Name
                             ("Compiler has not changed its name",
                              Error_Reporting.Problem),
                Explanation => "");
        end Await_Elaboration;
    begin
        if String_Utilities.Locate ("Motorola_68k", Target_Name) /= 0 then
            -- with Common, Control, Stream, the Start_Compiler procedure
            -- does not return until all components are started.
            Program.Run (Program.Current (Subsystem => Context & Target_Name,
                                          Unit => Routine,
                                          Parameters => Params,
                                          Activity => Activity));  
        else
            Program.Create_Job
               (Program.Current (Subsystem => Context & Target_Name,
                                 Unit => Routine,
                                 Activity => Activity),  
                Job_Id,  
                Status);
            Await_Elaboration;
        end if;
    exception
        when others =>
            Error_Reporting.Report_Error
               (Caller => Caller,
                Reason => Error_Reporting.Create_Condition_Name
                             ("Unhandled_Exception", Error_Reporting.Problem),
                Explanation => Debug_Tools.Get_Exception_Name (True, True));
    end Start_Compiler;
begin  
    begin
        Io.Open (File => File, Mode => Io.In_File, Name => File_Name);
    exception
        when Io.Name_Error =>
            -- file does not exist
            return;
    end;

    begin
        loop
            Start_Compiler (String_Utilities.Strip_Leading
                               (Filler => ' ', From => Io.Get_Line (File)));
        end loop;
    exception
        when Io.End_Error =>
            Close;
    end;
exception
    when others =>
        Close;
        raise;
end Initialize_Cross_Compilers;