DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400 Tapes

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 Tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download
Index: ┃ B T

⟦6d64fb917⟧ TextFile

    Length: 3655 (0xe47)
    Types: TextFile
    Names: »B«

Derivation

└─⟦a7d1ea751⟧ Bits:30000550 8mm tape, Rational 1000, !users!projects 94_04_11
    └─ ⟦129cab021⟧ »DATA« 
        └─⟦this⟧ 

TextFile

with Arguments;
with Boolean_Class;
with Integer_Class;
with Message;
with More_Binary;
with Msg_Report;
with Object;
with Scanner;
with String_Class;
with Unary;


package body Binary is
    type Node_Structure is
        record
            Info : Natural range 0 .. 1 := 0;  
            Unar : Unary.Node := Unary.Empty_Node;  
            Mobi : More_Binary.Node := More_Binary.Empty_Node;
            Lign : Integer;
        end record;

    procedure Parse (N : in out Node; Error : out Boolean) is
        Failed : Boolean := False;
    begin

        Msg_Report.Information ("I enter in binary's parse");

        N := new Node_Structure;

        N.Lign := Scanner.Line_Number;

        Unary.Parse (N.Unar, Failed);
        if not Failed then  
            if More_Binary.Is_First (Scanner.Symbol) then
                N.Info := 1;
                More_Binary.Parse (N.Mobi, Failed);  
            end if;
        end if;

        Msg_Report.Information ("I leave binary's parse with failed = " &
                                Boolean'Image (Failed));

        Error := Failed;

    end Parse;


    procedure Unparse (N : Node) is

    begin  
        Unary.Unparse (N.Unar);
        if N.Info = 1 then
            More_Binary.Unparse (N.Mobi);
        end if;
    end Unparse;


    function Is_First (T : Scanner.Token) return Boolean is
        use Scanner;
    begin
        return Unary.Is_First (T);
    end Is_First;

    function Interpret (N : Node;
                        Inherited : Object.Reference := Object.Void_Reference;
                        A_Bin_Mess : Message.Selector := Message.Void_Selector)
                       return Object.Reference is

        Result, First_Object : Object.Reference;
        An_Argument : Arguments.List := Arguments.Void_Arguments;

        use Object;
    begin

        Msg_Report.Information ("I enter in binary's interpret");

        Msg_Report.Set_Line_Number (N.Lign);

        Msg_Report.Information ("Binary message is " &
                                Message.Image (A_Bin_Mess));

        Result := Unary.Interpret (N.Unar);
        if Inherited = Object.Void_Reference then  
            if N.Info = 1 then
                Result := More_Binary.Interpret (N.Mobi, Result);
            end if;
        else
            First_Object := Inherited;  
            Arguments.Write (An_Argument, Result);

            case Object.The_Class (First_Object) is

                when Object.C_Block =>
                    null;

                when Object.C_Integer =>
                    Result := Integer_Class.Send
                                 (First_Object, A_Bin_Mess, An_Argument);

                when Object.C_Boolean =>
                    Result := Boolean_Class.Send
                                 (First_Object, A_Bin_Mess, An_Argument);

                when Object.C_String =>
                    Result := String_Class.Send
                                 (First_Object, A_Bin_Mess, An_Argument);

                when Object.C_Turtle =>
                    null;

                when Object.C_Pen =>
                    null;

                when Object.C_Void =>
                    null;

            end case;  
            if N.Info = 1 then
                Result := More_Binary.Interpret (N.Mobi, Result);  
            end if;
        end if;

        Msg_Report.Information ("I leave binary's interpret with result :");
        Msg_Report.Continue
           ("class = " & Object.Class'Image (Object.The_Class (Result)) &
            " ident = " & Integer'Image (Object.Identificator (Result)));

        return Result;
    end Interpret;
end Binary;