|
|
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: 10240 (0x2800)
Types: Ada Source
Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Find_Literals, seg_004405
└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000
└─⟦5a81ac88f⟧ »Space Info Vol 1«
└─⟦this⟧
with Lrm_Utilities;
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 More_String_Utilities;
package body Find_Literals is
function Lit_Context (Elem : Ada.Element) return String is
Parent : Ada.Element := Ada.Parent (Elem);
begin
case Ada.Kind (Parent) is
when Ada.A_Statement =>
return More_String_Utilities.Replaced
(Stmts.Statement_Kinds'Image (Stmts.Kind (Parent)));
when Ada.A_Declaration =>
case Decls.Kind (Parent) is
when Decls.A_Variable_Declaration =>
if Lrm_Utilities.Is_Actual_Variable_Declaration
(Parent) then
return More_String_Utilities.Replaced
(Decls.Declaration_Kinds'Image
(Decls.Kind (Parent)));
else
return "A RECORD COMPONENT";
end if;
when others =>
return More_String_Utilities.Replaced
(Decls.Declaration_Kinds'Image
(Decls.Kind (Parent)));
end case;
when Ada.A_Pragma =>
return "PRAGMA";
when Ada.A_Representation_Clause =>
return "REP SPEC";
when others =>
return "OTHER";
end case;
end Lit_Context;
function Literal_Kind (Elem : Ada.Element) return String is
begin
case Exprs.Kind (Elem) is
when Exprs.A_Character_Literal =>
return "CHARACTER";
when Exprs.An_Integer_Literal =>
return "INTEGER";
when Exprs.A_Real_Literal =>
return "REAL";
when Exprs.An_Enumeration_Literal =>
return "ENUMERATION";
when Exprs.A_Null_Literal =>
return "NULL";
when Exprs.A_String_Literal =>
return "STRING";
when others =>
return "UNKNOWN";
end case;
end Literal_Kind;
procedure Add (Units : String := "";
To_Document : in out Abstract_Document.Handle;
Include_String_Literals : Boolean := True;
Include_Character_Literals : Boolean := True;
Include_Integer_Literals : Boolean := True;
Include_Real_Literals : Boolean := True;
Include_Enumeration_Literals : Boolean := False;
Include_Null_Literals : Boolean := False;
Response : String := "<PROFILE>") is
Units_Iter : Object.Iterator := Naming.Resolution (Units);
type Columns is (Kind, Context, Literal, Type_Name);
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 Exprs.Kind (Elem) is
when Exprs.A_Character_Literal =>
return Include_Character_Literals;
when Exprs.An_Integer_Literal =>
return Include_Integer_Literals;
when Exprs.A_Real_Literal =>
return Include_Real_Literals;
when Exprs.An_Enumeration_Literal =>
return Include_Enumeration_Literals;
when Exprs.A_Null_Literal =>
return Include_Null_Literals;
when Exprs.A_String_Literal =>
return Include_String_Literals;
when others =>
return False;
end case;
end Is_Included;
function Explanation (C : Columns;
Elem : Ada.Element) return String is
begin
case C is
when Literal =>
return "The literal";
when Kind =>
return "The kind of the literal";
when Context =>
return "Context is which the literal appears";
when Type_Name =>
return "The type of the literal";
end case;
end Explanation;
function Column_Image (C : Columns;
Elem : Ada.Element) return String is
begin
case C is
when Literal =>
return Ada.Image (Elem);
when Context =>
return Lit_Context (Elem);
when Kind =>
return Literal_Kind (Elem);
when Type_Name =>
return Decls.Name (Decls.Enclosing_Declaration
(Exprs.Expression_Type (Elem)));
end case;
end Column_Image;
procedure Linkage (C : Columns;
Elem : Ada.Element;
Linkage_Element : out Ada.Element;
Linkage_Elements : out Ada.Element_List) is
begin
Linkage_Elements := Ada.Nil_List;
case C is
when Literal =>
Linkage_Element := Elem;
when Context =>
Linkage_Element := Ada.Parent (Elem);
when Kind =>
Linkage_Element := Elem;
when Type_Name =>
Linkage_Element := Exprs.Expression_Type (Elem);
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 => "LITERALS");
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 := "Literal_Info";
Include_String_Literals : Boolean := True;
Include_Character_Literals : Boolean := True;
Include_Integer_Literals : Boolean := True;
Include_Real_Literals : Boolean := True;
Include_Enumeration_Literals : Boolean := False;
Include_Null_Literals : Boolean := False;
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,
Include_String_Literals,
Include_Character_Literals,
Include_Integer_Literals,
Include_Real_Literals,
Include_Enumeration_Literals,
Include_Null_Literals,
Response);
Abstract_Document.Close (Document);
Common.Definition (To_Preview_Object);
end case;
end Display;
end Find_Literals;
nblk1=9
nid=0
hdr6=12
[0x00] rec0=1e rec1=00 rec2=01 rec3=038
[0x01] rec0=1a rec1=00 rec2=02 rec3=00c
[0x02] rec0=16 rec1=00 rec2=03 rec3=064
[0x03] rec0=19 rec1=00 rec2=04 rec3=022
[0x04] rec0=1c rec1=00 rec2=05 rec3=010
[0x05] rec0=18 rec1=00 rec2=06 rec3=01c
[0x06] rec0=19 rec1=00 rec2=07 rec3=02e
[0x07] rec0=16 rec1=00 rec2=08 rec3=018
[0x08] rec0=0d rec1=00 rec2=09 rec3=000
tail 0x215003384815c6386e16c 0x42a00088462061e03