DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about Rational R1000/400

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download

⟦91735e028⟧ Ada Source

    Length: 8192 (0x2000)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Primary, seg_03872e

Derivation

└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000
    └─ ⟦cfc2e13cd⟧ »Space Info Vol 2« 
        └─⟦this⟧ 

E3 Source Code



with Message;
with Value, Block;
with Class_Integer, Class_String, Class_Block;
with Class_Printer;
with Bug_Report;
with Bounded_String;
with String_Utilities;

package body Primary is

    type Node_Structure is
        record
            Rule : Natural range 0 .. 4 := 0;
            Obj : Object.Reference := Object.Void_Reference;
            Ident : Message.Unary;
            Val : Value.Node := Value.Empty_Node;
            Blk : Block.Node := Block.Get_Current_Node;
            Line : Object.Index := Scanner.Get_Line_Number;
        end record;

    procedure Parse (N : in out Node) is
        Result : Integer;
        Success : Boolean;
        use Scanner;
    begin  
        N := new Node_Structure;  
        case Scanner.Get_Token is
            when Scanner.Integer =>
                N.Rule := 0;
                String_Utilities.String_To_Number
                   (Source => Bounded_String.Image (Scanner.Get_Value),
                    Worked => Success,
                    Target => Result);
                N.Obj := Class_Integer.Create (Object.Index (Result));
                Scanner.Next;
            when Scanner.String =>
                N.Rule := 1;  
                N.Obj := Class_String.Create (Scanner.Get_Value);
                Scanner.Next;
            when Scanner.Identifier =>
                N.Rule := 2;
                Message.Put (Scanner.Get_Value, N.Ident);
                Scanner.Next;
            when Scanner.Open_Parenthesis =>
                N.Rule := 3;  
                Scanner.Next;
                Value.Parse (N.Val);
                if Scanner.Get_Token = Scanner.Close_Parenthesis then
                    Scanner.Next;
                else
                    raise Bug_Report.Parenthesis_Is_Missing;
                end if;
            when Scanner.Open_Brace =>
                N.Rule := 4;
                Block.Parse (N.Blk);
                N.Obj := Class_Block.Create (Node => N.Blk);
            when others =>
                raise Bug_Report.Unexpected_Token;
        end case;
    end Parse;

    function Is_First (T : Scanner.Token) return Boolean is
        use Scanner;
    begin
        return T = Scanner.Integer or else T = Scanner.String or else
                  T = Scanner.Identifier or else
                  T = Scanner.Open_Parenthesis or else
                  T = Scanner.Open_Brace or else Block.Is_First (T);
    end Is_First;

    procedure Unparse (N : Node) is
        Result : Object.Reference := Object.Void_Reference;
        Success : Boolean;
    begin
        case N.Rule is
            when 0 =>
                Class_Printer.Put
                   (String_Utilities.Number_To_String
                       (Value => (Integer (Object.Get (Index_From => N.Obj)))));
            when 1 =>
                Class_Printer.Put
                   ('"' &
                    Bounded_String.Image
                       (Class_String.Get (Object.Get (Index_From => N.Obj))) &
                    '"');
            when 2 =>
                Class_Printer.Put (Bounded_String.Image
                                      (Message.Get (N.Ident)));
            when 3 =>
                Class_Printer.Put ("(");
                Value.Unparse (N.Val);
                Class_Printer.Put (")");
            when 4 =>
                Block.Unparse (N.Blk);
        end case;
    end Unparse;

    function Interpret (N : Node) return Object.Reference is
        Result : Object.Reference := Object.Void_Reference;
        Success : Boolean;
    begin
        Scanner.Put_Line_Number (N.Line);
        case N.Rule is
            when 0 =>
                Result := N.Obj;
            when 1 =>
                Result := N.Obj;
            when 2 =>
                Block.Get_From_Table (Object_Named => Message.Get (N.Ident),
                                      From_Block => N.Blk,
                                      Into => Result,
                                      Status => Success);
                if not Success then
                    raise Bug_Report.Undefined_Identifier;
                end if;
            when 3 =>
                Result := Value.Interpret (N.Val);
            when 4 =>
                Result := N.Obj;
        end case;
        return Result;  
    end Interpret;
end Primary;

E3 Meta Data

    nblk1=7
    nid=0
    hdr6=e
        [0x00] rec0=21 rec1=00 rec2=01 rec3=016
        [0x01] rec0=02 rec1=00 rec2=03 rec3=01e
        [0x02] rec0=18 rec1=00 rec2=06 rec3=026
        [0x03] rec0=1a rec1=00 rec2=02 rec3=098
        [0x04] rec0=06 rec1=00 rec2=05 rec3=018
        [0x05] rec0=1b rec1=00 rec2=07 rec3=01a
        [0x06] rec0=07 rec1=00 rec2=04 rec3=001
    tail 0x21736249484e76969366e 0x42a00088462060003