|
|
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 Block, seg_038189
└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000
└─⟦cfc2e13cd⟧ »Space Info Vol 2«
└─⟦this⟧
with Statements, Arguments;
with Class_Block;
with Class_Printer;
with Bug_Report;
package body Block is
type Node_Structure is
record
Table : Symbols.Table := Symbols.Create;
Kwd : Message.Unary;
Ident : Message.Unary;
Stat : Statements.Node := Statements.Empty_Node;
Parent : Block.Node := Block.Empty_Node;
Line : Object.Index := Scanner.Get_Line_Number;
end record;
Current_Node : Block.Node;
Ghost : Object.Reference;
function Get_Ident (N : Node) return Message.Unary is
begin
return N.Ident;
end Get_Ident;
function Get_Kwd (N : Node) return Message.Unary is
begin
return N.Kwd;
end Get_Kwd;
function Get_Table (N : Node) return Symbols.Table is
begin
return N.Table;
end Get_Table;
procedure Put_Table (This_Object : Object.Reference;
Named : Object.Tiny_String;
Into : in out Node) is
begin
Symbols.Put (This_Object, Named, Into.Table);
end Put_Table;
procedure Get_From_Table (Object_Named : Object.Tiny_String;
From_Block : Node;
Into : in out Object.Reference;
Status : out Boolean) is
Block_Node : Node := From_Block;
Success : Boolean := False;
begin
while not Success and then Block_Node /= Empty_Node loop
Symbols.Get (Object_Named => Object_Named,
From_Table => Block_Node.Table,
Into => Into,
Status => Success);
if not Success then
Block_Node := Block_Node.Parent;
end if;
end loop;
Status := Success;
end Get_From_Table;
procedure Put_Into_Table (This_Object : Object.Reference;
Named : Object.Tiny_String;
Into_Block : in out Node) is
Block_Node : Node := Into_Block;
Success : Boolean := False;
Result : Object.Reference;
begin
while not Success and then Block_Node /= Empty_Node loop
Symbols.Get (Object_Named => Named,
From_Table => Block_Node.Table,
Into => Result,
Status => Success);
if not Success then
Block_Node := Block_Node.Parent;
end if;
end loop;
if Block_Node = Empty_Node and Block_Node /= Into_Block then
Symbols.Put (This_Object, Named, Into_Block.Table);
else
Symbols.Put (This_Object, Named, Block_Node.Table);
end if;
end Put_Into_Table;
function Get_Current_Node return Node is
begin
return Current_Node;
end Get_Current_Node;
function Get_Current_Table return Symbols.Table is
begin
return Current_Node.Table;
end Get_Current_Table;
procedure Put_Current_Table (This_Object : Object.Reference;
Named : Object.Tiny_String) is
begin
Symbols.Put (This_Object, Named, Current_Node.Table);
end Put_Current_Table;
function Get_Parent (N : Node) return Node is
begin
return N.Parent;
end Get_Parent;
function Is_Nil (N : Node) return Boolean is
begin
return N = Empty_Node;
end Is_Nil;
procedure Parse (N : in out Node) is
use Scanner;
begin
N := new Node_Structure;
N.Parent := Current_Node;
Current_Node := N;
if Scanner.Get_Token = Scanner.Open_Brace then
Scanner.Next;
Arguments.Parse (N.Ident, N.Kwd);
Statements.Parse (N.Stat);
if Scanner.Get_Token = Scanner.Close_Brace then
Scanner.Next;
else
raise Bug_Report.Brace_Is_Missing;
end if;
Current_Node := N.Parent;
else
raise Bug_Report.Unexpected_Token;
end if;
end Parse;
function Is_First (T : Scanner.Token) return Boolean is
use Scanner;
begin
return T = Open_Brace;
end Is_First;
procedure Unparse (N : Node) is
Node : Block.Node := Block.Current_Node;
begin
Current_Node := N;
Class_Printer.Put ("{");
Class_Printer.New_Line;
Class_Printer.Forward (4);
Arguments.Unparse (N.Ident, N.Kwd);
Statements.Unparse (N.Stat);
Class_Printer.New_Line;
Class_Printer.Backward (4);
Class_Printer.Put ("}");
Current_Node := Node;
end Unparse;
function Interpret (N : Node) return Object.Reference is
Result : Object.Reference := Object.Void_Reference;
Node : Block.Node := Block.Current_Node;
begin
Scanner.Put_Line_Number (N.Line);
Current_Node := N;
Result := Statements.Interpret (N.Stat);
Current_Node := Node;
return Result;
end Interpret;
begin
Current_Node := new Node_Structure;
Ghost := Class_Block.Create (Block.Get_Current_Node);
end Block;
nblk1=8
nid=0
hdr6=10
[0x00] rec0=27 rec1=00 rec2=01 rec3=032
[0x01] rec0=01 rec1=00 rec2=04 rec3=05e
[0x02] rec0=1b rec1=00 rec2=02 rec3=014
[0x03] rec0=00 rec1=00 rec2=05 rec3=03a
[0x04] rec0=1d rec1=00 rec2=07 rec3=018
[0x05] rec0=20 rec1=00 rec2=06 rec3=022
[0x06] rec0=20 rec1=00 rec2=03 rec3=008
[0x07] rec0=0e rec1=00 rec2=08 rec3=001
tail 0x21735ba3484e67ca16f5a 0x42a00088462060003