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

⟦23992ceeb⟧ Ada Source

    Length: 16384 (0x4000)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Find_Tasks, seg_004411

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 Log;
with Profile;
with Common;
with Add_Hyper_Table;
with Create_Null_Document;
with Lrm_Renames;
use Lrm_Renames;
with Directory_Renames;
use Directory_Renames;
with Errors;
with Simple_Status;
with String_Utilities;
with Lrm_Utilities;
package body Find_Tasks is

    procedure Walk_Through_Parents
                 (Item : Ada.Element;
                  Enclosing_Task : in out Ada.Element;
                  Enclosing_Program_Unit : in out Ada.Element) is
        Parent : Ada.Element := Ada.Parent (Item);
    begin
        case Ada.Kind (Parent) is
            when Ada.A_Compilation_Unit =>
                return;
            when others =>
                case Decls.Kind (Parent) is
                    when Decls.A_Task_Body_Declaration =>
                        Enclosing_Task := Parent;
                    when Decls.A_Procedure_Body_Declaration |
                         Decls.A_Function_Body_Declaration |
                         Decls.A_Package_Body_Declaration =>
                        if Ada.Is_Nil (Enclosing_Program_Unit) then
                            Enclosing_Program_Unit := Parent;
                        end if;
                        Walk_Through_Parents (Parent,  
                                              Enclosing_Task,  
                                              Enclosing_Program_Unit);

                    when others =>
                        Walk_Through_Parents (Parent,  
                                              Enclosing_Task,  
                                              Enclosing_Program_Unit);
                end case;

        end case;
    end Walk_Through_Parents;

    function Get_Caller (Item : Ada.Element) return Ada.Element is
        Enclosing_Task         : Ada.Element := Ada.Nil_Element;
        Enclosing_Program_Unit : Ada.Element := Ada.Nil_Element;
    begin
        Walk_Through_Parents (Item, Enclosing_Task, Enclosing_Program_Unit);
        if Ada.Is_Nil (Enclosing_Task) then
            return Enclosing_Program_Unit;
        else
            return Enclosing_Task;
        end if;
    end Get_Caller;

    procedure Add (Units       :        String := "";
                   To_Document : in out Abstract_Document.Handle;
                   Response    :        String := "<PROFILE>") is

        Units_Iter : Object.Iterator := Naming.Resolution (Units);

        type Columns is (Task_Name, Entry_Name, Accepts, Entry_Calls, Caller);

        type Construct is (An_Entry, An_Accept, An_Entry_Call);

        Current_Construct : Construct;

        function Is_Integer_Column (C : Columns) return Boolean is
        begin
            return False;
        end Is_Integer_Column;

        function Is_Included (Elem : Ada.Element) return Boolean is
        begin
            case Ada.Kind (Elem) is
                when Ada.A_Declaration =>
                    case Decls.Kind (Elem) is
                        when Decls.An_Entry_Declaration =>
                            if Lrm_Utilities.Is_Actual_Declaration
                                  (Elem) and then
                               -- only include it as a separate item
                               -- if no accepts are present
                               Ada.Is_Nil (Ada.Definition (Elem)) then
                                Current_Construct := An_Entry;
                                return True;
                            else
                                return False;
                            end if;
                        when others =>
                            return False;
                    end case;
                when Ada.A_Statement =>
                    case Stmts.Kind (Elem) is
                        when Stmts.An_Accept_Statement =>
                            Current_Construct := An_Accept;
                            return True;
                        when Stmts.An_Entry_Call_Statement |
                             Stmts.A_Conditional_Entry_Call_Statement |
                             Stmts.A_Timed_Entry_Call_Statement =>
                            Current_Construct := An_Entry_Call;
                            return True;
                        when others =>
                            return False;
                    end case;
                when others =>
                    return False;
            end case;

        end Is_Included;

        function Get_Name (For_Task : Ada.Element) return String is
            Task_Spec : Ada.Element     := Decls.Specification (For_Task);
            Name      : constant String := Decls.Name (Task_Spec);
        begin
            case Decls.Kind (Task_Spec) is
                when Decls.A_Task_Type_Declaration =>
                    return Name & "(type)";
                when others =>
                    return Name;
            end case;
        end Get_Name;

        function Explanation (C    : Columns;  
                              Elem : Ada.Element) return String is
        begin
            case C is
                when Task_Name =>
                    return "Name of the task";
                when Entry_Name =>
                    return "Name of the called or accepted entry";
                when Accepts =>
                    case Current_Construct is
                        when An_Entry =>
                            return "Probable error; entry has no accepts";
                        when An_Accept =>
                            return "An accept statement";
                        when An_Entry_Call =>
                            return "See entry call next column";
                    end case;
                when Entry_Calls =>
                    case Current_Construct is
                        when An_Entry =>
                            return "";
                        when An_Accept =>
                            return "";
                        when An_Entry_Call =>
                            return "The entry Call";
                    end case;
                when Caller =>
                    case Current_Construct is
                        when An_Entry =>
                            return "";
                        when An_Accept =>
                            return "";
                        when An_Entry_Call =>
                            return "The name of the Caller";
                    end case;
            end case;

        end Explanation;

        function Column_Image (C    : Columns;  
                               Elem : Ada.Element) return String is
            The_Entry : Ada.Element;
        begin
            case Current_Construct is
                when An_Entry =>
                    case C is
                        when Task_Name =>
                            return Get_Name (Ada.Parent (Elem));
                        when Entry_Name =>
                            return Decls.Name (Elem);
                        when Accepts =>
                            return "***NO ACCEPTS***";
                        when Entry_Calls | Caller =>
                            return "";
                    end case;

                when An_Accept =>
                    The_Entry := Stmts.Accepted_Entry (Elem);
                    case C is
                        when Task_Name =>
                            return Get_Name (Ada.Parent (The_Entry));
                        when Entry_Name =>
                            return Decls.Name (The_Entry);
                        when Accepts =>
                            return String_Utilities.Strip (Ada.Image (Elem));
                        when Entry_Calls | Caller =>
                            return " ";
                    end case;
                when An_Entry_Call =>
                    The_Entry := Ada.Definition (Elem);
                    case C is
                        when Task_Name =>
                            return Get_Name
                                      (Ada.Parent (Decls.Enclosing_Declaration
                                                      (The_Entry)));
                        when Entry_Name =>
                            return Decls.Name (The_Entry);
                        when Accepts =>
                            return "";
                        when Entry_Calls =>
                            return String_Utilities.Strip (Ada.Image (Elem));
                        when Caller =>
                            return Decls.Name (Get_Caller (Elem));
                    end case;
            end case;


        end Column_Image;

        procedure Linkage (C                :     Columns;
                           Elem             :     Ada.Element;
                           Linkage_Element  : out Ada.Element;
                           Linkage_Elements : out Ada.Element_List) is
            The_Entry : Ada.Element;
        begin
            Linkage_Elements := Ada.Nil_List;

            case Current_Construct is
                when An_Entry =>
                    case C is
                        when Task_Name =>
                            Linkage_Element := Ada.Parent (Elem);
                        when Entry_Name =>
                            Linkage_Element := Elem;
                        when Accepts | Entry_Calls | Caller =>
                            Linkage_Element := Ada.Nil_Element;
                    end case;

                when An_Accept =>
                    The_Entry := Stmts.Accepted_Entry (Elem);
                    case C is
                        when Task_Name =>
                            Linkage_Element := Ada.Parent (The_Entry);
                        when Entry_Name =>
                            Linkage_Element := The_Entry;
                        when Accepts =>
                            Linkage_Element := Elem;
                        when Entry_Calls | Caller =>
                            Linkage_Element := Ada.Nil_Element;
                    end case;
                when An_Entry_Call =>
                    The_Entry := Ada.Definition (Elem);
                    case C is
                        when Task_Name =>
                            Linkage_Element := Ada.Parent (The_Entry);
                        when Entry_Name =>
                            Linkage_Element := The_Entry;
                        when Accepts =>
                            Linkage_Element := Ada.Nil_Element;
                        when Entry_Calls =>
                            Linkage_Element := Elem;
                        when Caller =>
                            Linkage_Element := Get_Caller (Elem);
                    end case;
            end case;
        end Linkage;

        procedure Add_Hyper_Table_To_Doc is
           new Add_Hyper_Table
                  (Is_Included,  
                   Columns,  
                   Is_Integer_Column, Column_Image, Explanation, Linkage,  
                   Table_Title => "TASKING ANALYSIS");
    begin
        if Object.Is_Bad (Units_Iter) then
            Log.Put_Line (Units & " is not a valid pathname",
                          Profile.Error_Msg);
        else
            Add_Hyper_Table_To_Doc (Units_Iter, To_Document);
        end if;
    end Add;

    procedure Display (Units             : String := "";
                       To_Preview_Object : String := "Tasking_Info";
                       Response          : String := "<PROFILE>") is
        Document  : Abstract_Document.Handle;
        Condition : Errors.Condition;
    begin

        Create_Null_Document (Named           => To_Preview_Object,
                              Error_Info      => Condition,
                              Document_Handle => Document);

        case Errors.Severity (Condition) is
            when Simple_Status.Problem | Simple_Status.Fatal =>
                Log.Put_Line ("Problem creating object " & To_Preview_Object &
                              ".  " & Errors.Info (Condition),
                              Profile.Error_Msg);
            when others =>

                Add (Units, Document, Response);

                Abstract_Document.Close (Document);
                Common.Definition (To_Preview_Object);

        end case;
    end Display;
end Find_Tasks;

E3 Meta Data

    nblk1=f
    nid=0
    hdr6=1e
        [0x00] rec0=20 rec1=00 rec2=01 rec3=030
        [0x01] rec0=15 rec1=00 rec2=02 rec3=096
        [0x02] rec0=01 rec1=00 rec2=0f rec3=008
        [0x03] rec0=1d rec1=00 rec2=03 rec3=00c
        [0x04] rec0=13 rec1=00 rec2=04 rec3=03c
        [0x05] rec0=18 rec1=00 rec2=05 rec3=024
        [0x06] rec0=01 rec1=00 rec2=0e rec3=000
        [0x07] rec0=16 rec1=00 rec2=06 rec3=052
        [0x08] rec0=1a rec1=00 rec2=07 rec3=080
        [0x09] rec0=16 rec1=00 rec2=08 rec3=052
        [0x0a] rec0=17 rec1=00 rec2=09 rec3=022
        [0x0b] rec0=17 rec1=00 rec2=0a rec3=020
        [0x0c] rec0=16 rec1=00 rec2=0b rec3=03e
        [0x0d] rec0=18 rec1=00 rec2=0c rec3=05c
        [0x0e] rec0=11 rec1=00 rec2=0d rec3=000
    tail 0x2170016e0815c63a35a12 0x42a00088462061e03