|
|
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 Primary, seg_037e16
└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000
└─⟦5a81ac88f⟧ »Space Info Vol 1«
└─⟦this⟧
with Block;
with Block_Class;
with Boolean_Class;
with Bounded_String;
with Custom;
with Errors;
with Integer_Class;
with String_Class;
with String_Utilities;
with Trace;
with Unparser;
with Value;
package body Primary is
type Node_Structure is
record
Line : Natural;
Rule : Natural range 1 .. 5;
Obj : Object.Reference := Object.Void_Reference;
Ident : Scanner.Lexeme;
Val : Value.Node := Value.Empty_Node;
Bloc : Block.Node := Block.Empty_Node;
end record;
procedure Parse (N : in out Node) is
This_Int : Integer;
Conv_Ok : Boolean;
begin
Trace.Display ("parsing Primary");
N := new Node_Structure;
N.Line := Scanner.Get_Line_Number;
if Block.Is_First (Scanner.Get_Token) then
N.Rule := 5;
N.Obj := Block_Class.Create;
Block.Parse (N.Bloc);
Block_Class.Set_Node (N.Obj, N.Bloc);
else
case Scanner.Get_Token is
when Scanner.L_Int =>
N.Rule := 1;
String_Utilities.String_To_Number
(Bounded_String.Image (Scanner.Get_Value),
This_Int, Conv_Ok);
N.Obj := Integer_Class.Create (This_Int);
Scanner.Next_Token;
when Scanner.L_Str =>
N.Rule := 2;
N.Obj := String_Class.Create (Scanner.Get_Value);
Scanner.Next_Token;
when Scanner.L_Id =>
N.Rule := 3;
N.Ident := Scanner.Get_Value;
Scanner.Next_Token;
when Scanner.L_Opar =>
N.Rule := 4;
Scanner.Next_Token;
if Value.Is_First (Scanner.Get_Token) then
Value.Parse (N.Val);
case Scanner.Get_Token is
when Scanner.L_Cpar =>
Scanner.Next_Token;
when others =>
raise Errors.Expecting_Closing_Parenthesis;
end case;
else
raise Errors.Expecting_Value;
end if;
when others =>
raise Errors.Expecting_Primary_First;
end case;
end if;
end Parse;
procedure Unparse (N : Node) is
begin
case N.Rule is
when 1 =>
Unparser.Put
(String_Utilities.Number_To_String (Object.Get_Id (N.Obj)) &
" ");
when 2 =>
Unparser.Put ("""");
Unparser.Put (String_Class.Get_Value (N.Obj));
Unparser.Put (""" ");
when 3 =>
Unparser.Put (N.Ident);
Unparser.Put (" ");
when 4 =>
Unparser.Put ("( ");
Value.Unparse (N.Val);
Unparser.Put (") ");
when 5 =>
Block.Unparse (N.Bloc, N.Obj);
end case;
Trace.Display ("fin unparse primary");
end Unparse;
function Is_First (T : Scanner.Token) return Boolean is
use Scanner;
begin
return T = Scanner.L_Int or else T = Scanner.L_Str or else
T = Scanner.L_Id or else
T = Scanner.L_Opar or else Block.Is_First (T);
end Is_First;
function Interpret (N : Node) return Object.Reference is
Result : Object.Reference;
begin
Errors.Save_Interpret_Line (N.Line);
case N.Rule is
when 1 =>
Result := N.Obj;
when 2 =>
Result := N.Obj;
when 3 =>
Result := Block_Class.Get_Value (N.Ident);
when 4 =>
Result := Value.Interpret (N.Val);
when 5 =>
Result := N.Obj;
end case;
Trace.Display ("fin interpretation primary");
Trace.Display (Result);
return Result;
end Interpret;
end Primary;
nblk1=9
nid=5
hdr6=a
[0x00] rec0=26 rec1=00 rec2=01 rec3=014
[0x01] rec0=16 rec1=00 rec2=08 rec3=03a
[0x02] rec0=1b rec1=00 rec2=03 rec3=00a
[0x03] rec0=1e rec1=00 rec2=06 rec3=010
[0x04] rec0=0f rec1=00 rec2=09 rec3=000
[0x05] rec0=15 rec1=00 rec2=03 rec3=000
[0x06] rec0=14 rec1=00 rec2=02 rec3=001
[0x07] rec0=e8 rec1=4c rec2=19 rec3=26a
[0x08] rec0=31 rec1=92 rec2=00 rec3=003
tail 0x21531337884e58f11a86a 0x42a00088462060003
Free Block Chain:
0x5: 0000 00 02 00 06 80 03 20 20 20 03 0a 20 20 20 20 20 ┆ ┆
0x2: 0000 00 07 00 30 00 12 20 20 20 20 65 6e 64 20 49 6e ┆ 0 end In┆
0x7: 0000 00 04 02 1e 80 40 20 20 20 20 20 20 20 20 20 20 ┆ @ ┆
0x4: 0000 00 00 00 08 80 01 3b 01 00 01 20 01 73 5f 50 72 ┆ ; s_Pr┆