|
DataMuseum.dkPresents historical artifacts from the history of: Rational R1000/400 |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Rational R1000/400 Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - download
Length: 11264 (0x2c00) Types: Ada Source Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Display, package body Table_Building_Generic, seg_0046ce
└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000 └─⟦cfc2e13cd⟧ »Space Info Vol 2« └─⟦this⟧
with Io; with String_Utilities; with More_String_Utilities; with Table_Formatter; with Declarations; package body Table_Building_Generic is package Float_Io is new Io.Float_Io (Float); function Float_Image (F : Float) return String is S : String (1 .. 10); begin Float_Io.Put (S, F, 2, 0); return String_Utilities.Strip (S); end Float_Image; function Image (E : Enum) return String is Base : constant String := More_String_Utilities.Replaced (Enum'Image (E)); First_Blank : Natural := String_Utilities.Locate (' ', Base); begin if First_Blank = 0 then return Base & 'S'; elsif Base (Base'First .. First_Blank - 1) = "A" or else Base (Base'First .. First_Blank - 1) = "AN" then return Base (First_Blank + 1 .. Base'Last) & 'S'; elsif Base (Base'Last) = 'S' then return Base & 'S'; else return Base; end if; end Image; function Reference (E : Enum) return String is begin return '(' & String_Utilities.Strip (Integer'Image (Enum'Pos (E) + 1)) & ')'; end Reference; function Unit_Name (Decl : Ada_Program.Declaration) return String is Name : constant String := Declarations.Name (Decl); begin if Declarations.Is_Visible (Decl) then return Name & "'spec"; else return Name & "'body"; end if; end Unit_Name; package body Display is procedure Key_Table (To_Doc : in out Abstract_Document.Handle; Start : Enum := Enum'First; Stop : Enum := Enum'Pred (Enum'Last)) is package Table is new Table_Formatter (2); begin Table.Header ("Full Construct Name"); Table.Header ("Reference", Table.Centered); for E in Start .. Stop loop Table.Item (Enum_Image (E)); Table.Item (Reference (E)); end loop; Table.Display (To_Doc, "Key"); end Key_Table; procedure Unit_Comparison_Table (Unit_Ids : in out Ada_Program.Element_List; Db : Element_Db; Title : String; Start : Enum := Enum'First; Stop : Enum := Enum'Pred (Enum'Last); To_Doc : in out Abstract_Document.Handle) is Num_Elements : Natural := Enum'Pos (Stop) - Enum'Pos (Start) + 1; package Table is new Table_Formatter (Num_Elements + 1); Unit : Ada_Program.Element; For_Counts : Counts; Local_Total : Counts := (others => 0); begin Table.Header ("Unit", Format => Table.Left); for E in Start .. Stop loop Table.Header (Reference (E), Format => Table.Right); end loop; while not Ada_Program.Done (Unit_Ids) loop Unit := Ada_Program.Value (Unit_Ids); For_Counts := Get_Counts (Unit, Db); Table.Item (Unit_Name (Unit), Explanation => "Name of the analyzed Ada unit", Linkage => Unit); for E in Start .. Stop loop Local_Total (E) := Local_Total (E) + For_Counts (E); Table.Item (Natural'Image (For_Counts (E)), Explanation => "Total number of " & Enum_Image (E) & " for this unit"); end loop; Ada_Program.Next (Unit_Ids); end loop; Table.Item ("TOTAL", Explanation => "Totals for all units"); for E in Start .. Stop loop Table.Item (Natural'Image (Local_Total (E)), Explanation => "Total " & Enum_Image (E) & " for all units"); end loop; Table.Display (To_Doc, Title); Ada_Program.Reset (Unit_Ids); end Unit_Comparison_Table; function Table_Size (Divisor : Natural) return Positive is begin if Divisor = 0 then return 2; else return 3; end if; end Table_Size; procedure Table (Unit_Id : Ada_Program.Element; Title : String; Start : Enum := Enum'First; Stop : Enum := Enum'Pred (Enum'Last); Divisor : Natural := 0; Divisor_Title : String := ""; For_Counts : Counts; To_Doc : in out Abstract_Document.Handle) is package Table is new Table_Formatter (Table_Size (Divisor)); begin Table.Header ("Construct", Format => Table.Left); Table.Header ("Count", Format => Table.Right); if Divisor /= 0 then Table.Header (Divisor_Title, Format => Table.Right); end if; for E in Start .. Stop loop Table.Item (Enum_Image (E), Explanation => "Full name of the Ada Construct"); Table.Item (Natural'Image (For_Counts (E)), Explanation => "Total number of " & Enum_Image (E) & " in this unit"); if Divisor /= 0 then Table.Item (Float_Image (Float (For_Counts (E)) / Float (Divisor)), Explanation => Divisor_Title); end if; end loop; if Ada_Program.Is_Nil (Unit_Id) then Table.Display (To_Doc, Title); else Table.Display (To_Doc, Title & " for unit " & Declarations.Name (Unit_Id)); end if; end Table; end Display; end Table_Building_Generic;
nblk1=a nid=0 hdr6=14 [0x00] rec0=1d rec1=00 rec2=01 rec3=018 [0x01] rec0=01 rec1=00 rec2=0a rec3=01c [0x02] rec0=1c rec1=00 rec2=02 rec3=00e [0x03] rec0=15 rec1=00 rec2=03 rec3=008 [0x04] rec0=00 rec1=00 rec2=09 rec3=010 [0x05] rec0=12 rec1=00 rec2=04 rec3=058 [0x06] rec0=00 rec1=00 rec2=08 rec3=00c [0x07] rec0=18 rec1=00 rec2=05 rec3=006 [0x08] rec0=13 rec1=00 rec2=06 rec3=010 [0x09] rec0=0d rec1=00 rec2=07 rec3=000 tail 0x217002a20815c671186df 0x42a00088462061e03