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

⟦f6b34433d⟧ Ada Source

    Length: 12288 (0x3000)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Find_Allocators, seg_0043fd

Derivation

└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000
    └─ ⟦5a81ac88f⟧ »Space Info Vol 1« 
        └─⟦this⟧ 

E3 Source Code



with Log;
with Profile;
with Common;
with Errors;
with Simple_Status;
with Add_Hyper_Table;
with Create_Null_Document;
with Size_Utilities;
with Lrm_Renames;
use Lrm_Renames;
with Directory_Renames;
use Directory_Renames;
package body Find_Allocators is

    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 (Size, Allocator, Access_Object, Kind, Allocated_Type);

        function Is_Integer_Column (C : Columns) return Boolean is
        begin
            case C is
                when Size =>
                    return True;
                when others =>
                    return False;
            end case;
        end Is_Integer_Column;

        function Is_Included (Elem : Ada.Element) return Boolean is
        begin
            case Exprs.Kind (Elem) is
                when Exprs.An_Allocator =>
                    return True;
                when others =>
                    return False;
            end case;
        end Is_Included;

        function Explanation (C : Columns; Elem : Ada.Element) return String is
        begin
            case C is
                when Allocator =>
                    return "Allocator";
                when Size =>
                    return "Size of the allocated type";
                when Access_Object =>
                    return "Object holding the access value";
                when Kind =>
                    return
                       "Allocation kind; whether a subtype or qualified allocation";
                when Allocated_Type =>
                    return "Type of the allocated object";
            end case;
        end Explanation;

        function Column_Image (C : Columns; Elem : Ada.Element) return String is
            Type_Size : Size_Utilities.Long_Natural;
            Type_Def  : Ada.Element;
            Static    : Boolean     := True;
            Parent    : Ada.Element := Ada.Parent (Elem);
        begin
            case C is
                when Allocator =>
                    return Ada.Image (Elem);
                when Size =>
                    case Exprs.Allocator_Kind (Elem) is
                        when Exprs.Allocation_From_Subtype =>
                            Type_Def := Exprs.Allocation_Type (Elem);
                        when Exprs.Allocation_From_Qualified_Expression =>
                            Type_Def :=
                               (Exprs.Expression_Type
                                   (Exprs.Qualified_Object_Expression (Elem)));
                    end case;

                    Size_Utilities.Type_Size (For_Type => Type_Def,
                                              Result   => Type_Size,
                                              Static   => Static);
                    return Long_Integer'Image (Type_Size / 8);
                when Access_Object =>
                    case Ada.Kind (Parent) is
                        when Ada.A_Declaration =>
                            return Decls.Name (Parent);
                        when Ada.A_Statement =>
                            case Stmts.Kind (Parent) is
                                when Stmts.An_Assignment_Statement =>
                                    return Decls.Name
                                              (Ada.Definition
                                                  (Stmts.Object_Assigned_To
                                                      (Parent)));
                                when others =>
                                    return "";
                            end case;
                        when others =>
                            return "???";
                    end case;
                when Kind =>
                    case Exprs.Allocator_Kind (Elem) is
                        when Exprs.Allocation_From_Subtype =>
                            return "subtype";
                        when Exprs.Allocation_From_Qualified_Expression =>
                            return "qualified";
                    end case;
                when Allocated_Type =>  
                    case Exprs.Allocator_Kind (Elem) is
                        when Exprs.Allocation_From_Subtype =>
                            return Decls.Name
                                      (Decls.Enclosing_Declaration
                                          (Ada.Definition
                                              (Exprs.Allocation_Type (Elem))));
                        when Exprs.Allocation_From_Qualified_Expression =>
                            return Decls.Name
                                      (Decls.Enclosing_Declaration
                                          (Exprs.Expression_Type
                                              (Exprs.Qualified_Object_Expression
                                                  (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

            Parent : Ada.Element := Ada.Parent (Elem);
        begin
            Linkage_Elements := Ada.Nil_List;

            case C is
                when Allocator =>
                    Linkage_Element := Elem;
                when Access_Object =>
                    case Ada.Kind (Parent) is
                        when Ada.A_Statement =>
                            case Stmts.Kind (Parent) is
                                when Stmts.An_Assignment_Statement =>
                                    Linkage_Element :=
                                       Ada.Definition
                                          (Stmts.Object_Assigned_To (Parent));
                                when others =>
                                    Linkage_Element := Ada.Nil_Element;
                            end case;
                        when Ada.A_Declaration =>
                            Linkage_Element := Parent;
                        when others =>
                            Linkage_Element := Ada.Nil_Element;
                    end case;
                when Allocated_Type =>
                    case Exprs.Allocator_Kind (Elem) is
                        when Exprs.Allocation_From_Subtype =>
                            Linkage_Element :=
                               Decls.Enclosing_Declaration
                                  (Ada.Definition
                                      (Exprs.Allocation_Type (Elem)));
                        when Exprs.Allocation_From_Qualified_Expression =>
                            Linkage_Element :=
                               Decls.Enclosing_Declaration
                                  (Exprs.Expression_Type
                                      (Exprs.Qualified_Object_Expression
                                          (Elem)));
                    end case;
                when others =>
                    Linkage_Element := Ada.Nil_Element;
            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 => "ALLOCATORS");
    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 := "allocator_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_Allocators;

E3 Meta Data

    nblk1=b
    nid=0
    hdr6=16
        [0x00] rec0=23 rec1=00 rec2=01 rec3=00a
        [0x01] rec0=1a rec1=00 rec2=02 rec3=084
        [0x02] rec0=15 rec1=00 rec2=03 rec3=024
        [0x03] rec0=00 rec1=00 rec2=0b rec3=016
        [0x04] rec0=13 rec1=00 rec2=04 rec3=01a
        [0x05] rec0=11 rec1=00 rec2=05 rec3=068
        [0x06] rec0=18 rec1=00 rec2=06 rec3=006
        [0x07] rec0=12 rec1=00 rec2=07 rec3=022
        [0x08] rec0=17 rec1=00 rec2=08 rec3=034
        [0x09] rec0=17 rec1=00 rec2=09 rec3=05e
        [0x0a] rec0=05 rec1=00 rec2=0a rec3=000
    tail 0x2150032da815c6372c9ba 0x42a00088462061e03