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

⟦e11eab350⟧ Ada Source

    Length: 16384 (0x4000)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Binary_Expression, package body Generic_Expression, package body Primary_Expression, package body System_Defined, package body System_Defined_Expression, package body Unary_Expression, seg_04a30c, seg_04a9db, seg_04b448

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



package body Generic_Expression is

    type Expression_Owners is (System, User);

    package System_Defined is
        type Operators is ('+', '-', '*', '/', '&', Abs_Op);

        function Evaluate (Using_Operator : Operators; Right : Slot.Object)
                          return Slot.Object;
        function Evaluate (Using_Operator : Operators;
                           Left, Right    : Slot.Object) return Slot.Object;
        function Image    (Op : Operators)               return String;
    end System_Defined;


    package Primary_Expression is
        type Sub_Classes is (Alias_Value, Immediate_Value);
        type Object (Kind : Sub_Classes := Immediate_Value) is
            record
                case Kind is
                    when Alias_Value =>
                        The_Alias : Alias.Name;
                    when Immediate_Value =>
                        The_Value : Slot.Object;
                end case;
            end record;
        function  Value    (For_Object : Slot.Object) return Object;
        function  Value    (For_Alias : Alias.Name)   return Object;
        procedure Put      (The_Object : Object; Where : Output_Stream.Object);
        function  Evaluate (The_Object : Object)      return Slot.Object;
    end Primary_Expression;


    package Unary_Expression is  
        type Object (Owner : Expression_Owners := System) is
            record
                The_Operand : Generic_Expression.Object;
                case Owner is
                    when System =>
                        The_System_Operator : System_Defined.Operators;
                    when User =>
                        The_User_Operator : User_Defined_Operators;
                end case;
            end record;
        function  Make (The_Operator : System_Defined.Operators;
                        The_Operand  : Generic_Expression.Object) return Object;
        function  Make (The_Operator : User_Defined_Operators;                       The_Operand  : Generic_Expression.Object) return Object;
        procedure Put (The_Object : Object; Where : Output_Stream.Object);
        function  Evaluate (The_Object : Object) return Slot.Object;
    end Unary_Expression;


    package Binary_Expression is  
        type Object (Owner : Expression_Owners := System) is
            record
                The_Left_Operand  : Generic_Expression.Object;
                The_Right_Operand : Generic_Expression.Object;
                case Owner is
                    when System =>
                        The_System_Operator : System_Defined.Operators;
                    when User =>
                        The_User_Operator : User_Defined_Operators;
                end case;
            end record;
        function  Make     (The_Operator      : System_Defined.Operators;
                            The_Left_Operand  : Generic_Expression.Object;
                            The_Right_Operand : Generic_Expression.Object)
                      return Object;
        function  Make     (The_Operator      : User_Defined_Operators;
                            The_Left_Operand  : Generic_Expression.Object;
                            The_Right_Operand : Generic_Expression.Object)
                      return Object;
        procedure Put      (The_Object : Object; Where : Output_Stream.Object);
        function  Evaluate (The_Object : Object) return Slot.Object;
    end Binary_Expression;


    type Object_Structure (Sub_Class : Sub_Classes) is
        record
            case Sub_Class is
                when Primary =>
                    The_Primary_Code : Primary_Expression.Object;
                when Unary =>
                    The_Unary_Code : Unary_Expression.Object;
                when Binary =>
                    The_Binary_Code : Binary_Expression.Object;  
                when Undefined =>
                    null;
            end case;
        end record;


    function New_Node (For_Code : Object_Structure) return Object is
        Result : Object;
    begin  
        Result     := new Object_Structure (Sub_Class => For_Code.Sub_Class);
        Result.all := For_Code;  
        return Result;
    end New_Node;


    function Value (For_Object : Slot.Object) return Object is
    begin
        return New_Node ((Sub_Class        => Primary,
                          The_Primary_Code =>
                             Primary_Expression.Value (For_Object)));
    end Value;


    function Value (For_Integer : Integer) return Object is  
        The_Object : Slot.Object := Slot.Value (For_Integer);
    begin
        return New_Node ((Sub_Class        => Primary,
                          The_Primary_Code =>
                             Primary_Expression.Value (The_Object)));
    end Value;

    function Value (For_Boolean : Boolean) return Object is  
        The_Object : Slot.Object := Slot.Value (For_Boolean);
    begin
        return New_Node ((Sub_Class        => Primary,
                          The_Primary_Code =>
                             Primary_Expression.Value (The_Object)));
    end Value;

    function Value (For_Float : Float) return Object is  
        The_Object : Slot.Object := Slot.Value (For_Float);
    begin
        return New_Node ((Sub_Class        => Primary,
                          The_Primary_Code =>
                             Primary_Expression.Value (The_Object)));
    end Value;

    function Value (For_Character : Character) return Object is  
        The_Object : Slot.Object := Slot.Value (For_Character);
    begin
        return New_Node ((Sub_Class        => Primary,
                          The_Primary_Code =>
                             Primary_Expression.Value (The_Object)));
    end Value;

    function Value (For_Duration : Duration) return Object is  
        The_Object : Slot.Object := Slot.Value (For_Duration);
    begin
        return New_Node ((Sub_Class        => Primary,
                          The_Primary_Code =>
                             Primary_Expression.Value (The_Object)));
    end Value;

    function Value (For_String : String) return Object is  
        The_Object : Slot.Object := Slot.Value (For_String);
    begin
        return New_Node ((Sub_Class        => Primary,
                          The_Primary_Code =>
                             Primary_Expression.Value (The_Object)));
    end Value;


    function Value (For_Alias : Alias.Name) return Object is
    begin
        return New_Node ((Sub_Class        => Primary,
                          The_Primary_Code =>
                             Primary_Expression.Value (For_Alias)));
    end Value;


    function Unary_User_Expression (Right : Object) return Object is
        The_Code : Unary_Expression.Object;
    begin
        The_Code := Unary_Expression.Make (Operator, Right);
        return New_Node (For_Code => (Sub_Class      => Unary,
                                      The_Unary_Code => The_Code));
    end Unary_User_Expression;


    function Binary_User_Expression (Left, Right : Object) return Object is
        The_Code : Binary_Expression.Object;
    begin
        The_Code := Binary_Expression.Make (Operator, Left, Right);
        return New_Node (For_Code => (Sub_Class       => Binary,
                                      The_Binary_Code => The_Code));
    end Binary_User_Expression;


    function Evaluate (The_Expression : Object) return Slot.Object is
    begin
        if The_Expression = Null_Expression then
            return Slot.Null_Object;
        else
            case The_Expression.Sub_Class is
                when Primary =>
                    return Primary_Expression.Evaluate
                              (The_Expression.The_Primary_Code);
                when Unary =>
                    return Unary_Expression.Evaluate
                              (The_Expression.The_Unary_Code);
                when Binary =>
                    return Binary_Expression.Evaluate
                              (The_Expression.The_Binary_Code);
                when Undefined =>
                    raise Illegal_Operation;
            end case;
        end if;
    end Evaluate;


    procedure Put (The_Object : Object; Where : Output_Stream.Object) is
        use Output_Stream;
    begin
        if The_Object /= Null_Expression then
            case The_Object.Sub_Class is
                when Primary =>
                    Primary_Expression.Put (The_Object.The_Primary_Code, Where);
                when Unary =>
                    Unary_Expression.Put (The_Object.The_Unary_Code, Where);
                when Binary =>
                    Binary_Expression.Put (The_Object.The_Binary_Code, Where);
                when Undefined =>
                    Put ("Undefined expression", Where);
            end case;
        end if;
    end Put;

    package body System_Defined is separate;
    package body Primary_Expression is separate;
    package body Unary_Expression is separate;
    package body Binary_Expression is separate;
    package body System_Defined_Expression is separate;
end Generic_Expression;

E3 Meta Data

    nblk1=f
    nid=0
    hdr6=1e
        [0x00] rec0=1b rec1=00 rec2=01 rec3=02e
        [0x01] rec0=01 rec1=00 rec2=0f rec3=020
        [0x02] rec0=15 rec1=00 rec2=02 rec3=002
        [0x03] rec0=00 rec1=00 rec2=0e rec3=032
        [0x04] rec0=14 rec1=00 rec2=03 rec3=090
        [0x05] rec0=01 rec1=00 rec2=0c rec3=012
        [0x06] rec0=19 rec1=00 rec2=0d rec3=016
        [0x07] rec0=00 rec1=00 rec2=04 rec3=030
        [0x08] rec0=1c rec1=00 rec2=05 rec3=026
        [0x09] rec0=00 rec1=00 rec2=0b rec3=008
        [0x0a] rec0=18 rec1=00 rec2=06 rec3=034
        [0x0b] rec0=1a rec1=00 rec2=07 rec3=056
        [0x0c] rec0=19 rec1=00 rec2=08 rec3=028
        [0x0d] rec0=18 rec1=00 rec2=09 rec3=02a
        [0x0e] rec0=0a rec1=00 rec2=0a rec3=001
    tail 0x2174ea0fe866e7c2eb2d4 0x42a00088462063c03