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

⟦0dba64049⟧ Ada Source

    Length: 5120 (0x1400)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Expression_Node_Old, seg_041235

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 Expression_Node_Old is

    use Kind;

    function Evaluate (Item : in Object) return Integer is

        Result : Integer := 0;

    begin
        case Item.Kind is
            when '+' =>
                Result := Evaluate (Item.Left.all) + Evaluate (Item.Right.all);  
            when '-' =>
                Result := Evaluate (Item.Left.all) - Evaluate (Item.Right.all);
            when '*' =>
                Result := Evaluate (Item.Left.all) * Evaluate (Item.Right.all);
            when '/' =>
                Result := Evaluate (Item.Left.all) / Evaluate (Item.Right.all);  
            when Number =>
                Result := Item.Value;
            when Identifier =>
                null;
            when Unknown =>   -- exception
                null;
        end case;
        return Result;

    exception
        when Numeric_Error =>
            return 0;

    end Evaluate;


    function Make (Node_Kind : in Operator; Left_Node, Right_Node : in P_Object)
                  return P_Object is

        P_Node : P_Object;  -- inutile ??

    begin
        case Node_Kind is
            when '+' =>
                P_Node := new Object'(Kind => '+',
                                      Left => Left_Node,
                                      Right => Right_Node);
            when '-' =>
                P_Node := new Object'(Kind => '-',
                                      Left => Left_Node,
                                      Right => Right_Node);
            when '*' =>
                P_Node := new Object'(Kind => '*',
                                      Left => Left_Node,
                                      Right => Right_Node);
            when '/' =>
                P_Node := new Object'(Kind => '/',
                                      Left => Left_Node,
                                      Right => Right_Node);
        end case;
        return P_Node;
    end Make;


    function Make (Node_Value : in Integer) return P_Object is

        P_Node : P_Object;
    begin
        P_Node := new Object'(Kind => Number, Value => Node_Value);
        return P_Node;
    end Make;

    function Make (Node_Index_Entity, Node_Index_Field : in Element_Index)
                  return P_Object is

        P_Node : P_Object;

    begin
        P_Node := new Object'(Kind => Identifier,
                              Index_Entity => Node_Index_Entity,
                              Index_Field => Node_Index_Field);
        return P_Node;
    end Make;

end Expression_Node_Old;

E3 Meta Data

    nblk1=4
    nid=0
    hdr6=8
        [0x00] rec0=24 rec1=00 rec2=01 rec3=044
        [0x01] rec0=00 rec1=00 rec2=02 rec3=008
        [0x02] rec0=18 rec1=00 rec2=04 rec3=02c
        [0x03] rec0=19 rec1=00 rec2=03 rec3=000
    tail 0x217416b3c861352a4a966 0x42a00088462060003