|
|
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: 9216 (0x2400)
Types: Ada Source
Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Call_Tree_Queues, seg_0043e0
└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000
└─⟦cfc2e13cd⟧ »Space Info Vol 2«
└─⟦this⟧
with Io;
with Compilation_Units;
with Declarations;
with Statements;
with Names_And_Expressions;
package body Call_Tree_Queues is
package Ap renames Ada_Program;
package Decl renames Declarations;
package Stmt renames Statements;
package Conv renames Ap.Conversion;
package Expr renames Names_And_Expressions;
function "=" (L, R : Decl.Declaration_Kinds) return Boolean
renames Decl."=";
type State_Record is
record
Transitive_Call_Tree : Queues.Queue;
Current_Level : Natural := 1;
end record;
procedure Clear_State (State : in out State_Record)
is
begin
Queues.Make_Empty (State.Transitive_Call_Tree);
State.Current_Level := 0;
end Clear_State;
function Is_In_State (State : State_Record;
Subprogram_Id : in Ap.Element) return Boolean is
function "=" (L, R : Ap.Element) return Boolean renames Ap."=";
Subprograms_It : Queues.Iterator;
begin
Queues.Init (Subprograms_It, State.Transitive_Call_Tree);
while not Queues.Done (Subprograms_It) loop
if Subprogram_Id = Queues.Value (Subprograms_It).Subprogram_Id then
return True;
end if;
Queues.Next (Subprograms_It);
end loop;
return False;
end Is_In_State;
procedure Push_Level (State : in out State_Record) is
begin
State.Current_Level := State.Current_Level + 1;
end Push_Level;
procedure Pop_Level (State : in out State_Record) is
begin
State.Current_Level := State.Current_Level - 1;
end Pop_Level;
procedure Append_State (Subprogram_Id : in Ap.Element;
To : in out State_Record;
Id_Previously_Existed : out Boolean) is
In_Call_Tree : Boolean := Is_In_State (To, Subprogram_Id);
begin
Id_Previously_Existed := In_Call_Tree;
Queues.Add (To.Transitive_Call_Tree,
Referenced_Subprogram'
(Subprogram_Id, not In_Call_Tree, To.Current_Level));
end Append_State;
function Normalize_Subprogram_Body
(Element_That_Is_Close : Ap.Element) return Ap.Element is
Result : Ap.Element;
begin
begin
Result := Decl.Unit_Body (Element_That_Is_Close);
exception
when Ap.Inappropriate_Program_Element =>
return Ap.Nil_Element;
end;
if not Ap.Is_Nil (Result) then
case Decl.Kind (Result) is
when Decl.A_Procedure_Body_Declaration |
Decl.A_Function_Body_Declaration =>
null;
when others =>
Result := Ap.Nil_Element;
end case;
end if;
return Result;
end Normalize_Subprogram_Body;
-- Loop through renames to obtain real declaration
-- returns Spec declaration if it exists, otherwise returns Body decl
function Resolve_Rename (Program_Element : Ap.Element)
return Ap.Element is separate;
procedure Call_Tree_For_Iterator (Iter : in Ap.Element_Iterator;
The_State : in out State_Record);
procedure Recurse_Through_Subprogram (Called_Subprogram_Decl : Ap.Element;
The_State : in out State_Record);
procedure Pre_Op (Program_Element : Ap.Element;
State : in out State_Record;
Control : in out Ap.Traversal_Control);
procedure Post_Op (Program_Element : Ap.Element;
State : in out State_Record;
Control : in out Ap.Traversal_Control)
procedure Construct_Call_Tree is
new Ap.Depth_First_Traversal (State_Record, Pre_Op, Post_Op);
procedure Pre_Op (Program_Element : Ap.Element;
State : in out State_Record;
Control : in out Ap.Traversal_Control) is separate;
procedure Post_Op (Program_Element : Ap.Element;
State : in out State_Record;
Control : in out Ap.Traversal_Control) is separate;
procedure Recurse_Through_Subprogram
(Called_Subprogram_Decl : Ap.Element;
The_State : in out State_Record) is separate;
procedure Call_Tree_For_Iterator (Iter : in Ap.Element_Iterator;
The_State : in out State_Record) is
Local_Iter : Ap.Element_Iterator := Iter;
begin
while not Ap.Done (Local_Iter) loop
declare
Current : Ap.Element := Ap.Value (Local_Iter);
begin
Construct_Call_Tree (Root_Element => Ap.Value ((Local_Iter)),
State => The_State,
Major_Elements_Only => False);
end;
Ap.Next (Local_Iter);
end loop;
end Call_Tree_For_Iterator;
function Tree_For (This_Subprogram_Body : Ada_Program.Element)
return Queue is separate;
end Call_Tree_Queues;
nblk1=8
nid=0
hdr6=10
[0x00] rec0=20 rec1=00 rec2=01 rec3=044
[0x01] rec0=00 rec1=00 rec2=08 rec3=012
[0x02] rec0=1b rec1=00 rec2=02 rec3=07a
[0x03] rec0=1d rec1=00 rec2=03 rec3=02c
[0x04] rec0=15 rec1=00 rec2=04 rec3=08a
[0x05] rec0=00 rec1=00 rec2=07 rec3=002
[0x06] rec0=18 rec1=00 rec2=05 rec3=05c
[0x07] rec0=0f rec1=00 rec2=06 rec3=000
tail 0x217001684815c6340c7a8 0x42a00088462061e03