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

⟦ad86dbc44⟧ Ada Source

    Length: 13312 (0x3400)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Binary_Predicate, package body Generic_Predicate, package body Primary_Predicate, package body System_Defined, package body System_Defined_Predicate, package body Unary_Predicate, seg_02ccb9, seg_02cf10

Derivation

└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000
    └─ ⟦5a81ac88f⟧ »Space Info Vol 1« 
        └─⟦this⟧ 
└─⟦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_Predicate is

    type Predicate_Owners is (System, User);

    package System_Defined is
        type Operators is (Is_Equal, Is_Less, Is_Less_Or_Equal, Is_Greater,
                           Is_Greater_Or_Equal, Is_Different, Is_Any);

        function Match (Using_Operator : Operators;
                        Value          : Integer;
                        Against        : Integer) return Boolean;
        function Image (Op : Operators)           return String;
    end System_Defined;


    package Primary_Predicate is
        type Sub_Classes is (Alias_Definition, Predicate_Conjunction);
        type Object (Kind : Sub_Classes := Alias_Definition) is
            record
                case Kind is
                    when Alias_Definition =>
                        The_Alias : Alias.Name;
                    when Predicate_Conjunction =>
                        The_Left_Predicate  : Generic_Predicate.Object;
                        The_Right_Predicate : Generic_Predicate.Object;
                end case;
            end record;
        function  Make_Alias_Definition (The_Alias : Alias.Name) return Object;
        function  Make_Conjunction
                    (Left, Right : Generic_Predicate.Object) return Object;
        procedure Put (The_Object : Object; Where : Output_Stream.Object);
        function  Match (Value : Integer; Against : Object) return Boolean;
    end Primary_Predicate;


    package Unary_Predicate is  
        type Object (Owner : Predicate_Owners := System) is
            record
                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) return Object;
        function  Make  (The_Operator : User_Defined_Operators) return Object;
        procedure Put   (The_Object : Object; Where : Output_Stream.Object);
        function  Match (Value : Integer; Against : Object) return Boolean;
    end Unary_Predicate;


    package Binary_Predicate is  
        type Object (Owner : Predicate_Owners := System) is
            record
                The_Operand : 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  : Expression_Object)  return Object;
        function  Make  (The_Operator : User_Defined_Operators;
                         The_Operand  : Expression_Object)  return Object;
        procedure Put   (The_Object : Object; Where : Output_Stream.Object);
        function  Match (Value : Integer; Against : Object) return Boolean;
    end Binary_Predicate;


    type Object_Structure (Sub_Class : Sub_Classes) is
        record
            case Sub_Class is
                when Primary =>
                    The_Primary_Code : Primary_Predicate.Object;
                when Unary =>
                    The_Unary_Code : Unary_Predicate.Object;
                when Binary =>
                    The_Binary_Code : Binary_Predicate.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 Define_As (The_Alias : Alias.Name) return Object is
        The_Predicate : Primary_Predicate.Object;
    begin
        The_Predicate := Primary_Predicate.Make_Alias_Definition (The_Alias);
        return New_Node (For_Code => (Sub_Class        => Primary,
                                      The_Primary_Code => The_Predicate));
    end Define_As;


    function "and" (Left, Right : Object) return Object is
        The_Predicate : Primary_Predicate.Object;
    begin
        if Left = Null_Predicate then
            return Right;
        elsif Right = Null_Predicate then
            return Left;
        else
            The_Predicate := Primary_Predicate.Make_Conjunction (Left, Right);
            return New_Node (For_Code => (Sub_Class        => Primary,
                                          The_Primary_Code => The_Predicate));
        end if;
    end "and";


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


    function Binary_User_Predicate
                (Using_Value : Expression_Object) return Object is
        The_Code : Binary_Predicate.Object;
    begin
        The_Code := Binary_Predicate.Make (Operator, Using_Value);
        return New_Node (For_Code => (Sub_Class       => Binary,
                                      The_Binary_Code => The_Code));
    end Binary_User_Predicate;


    function Match (Value : Integer; Against : Object) return Boolean is
    begin  
        if Against = Null_Predicate then
            return False;
        else
            case Against.Sub_Class is
                when Primary =>
                    return Primary_Predicate.Match
                              (Value, Against.The_Primary_Code);
                when Unary =>
                    return Unary_Predicate.Match
                              (Value, Against.The_Unary_Code);
                when Binary =>
                    return Binary_Predicate.Match
                              (Value, Against.The_Binary_Code);
                when Undefined =>
                    raise Illegal_Operation;
            end case;
        end if;
    end Match;


    procedure Put (The_Object : Object; Where : Output_Stream.Object) is
        use Output_Stream;
    begin
        if The_Object /= Null_Predicate then
            case The_Object.Sub_Class is
                when Primary =>
                    Primary_Predicate.Put (The_Object.The_Primary_Code, Where);
                when Unary =>
                    Unary_Predicate.Put (The_Object.The_Unary_Code, Where);
                when Binary =>
                    Binary_Predicate.Put (The_Object.The_Binary_Code, Where);
                when Undefined =>
                    Put ("Undefined predicate", Where);
            end case;
        end if;
    end Put;

    package body System_Defined is separate;
    package body Primary_Predicate is separate;
    package body Unary_Predicate is separate;
    package body Binary_Predicate is separate;
    package body System_Defined_Predicate is separate;
end Generic_Predicate;

E3 Meta Data

    nblk1=c
    nid=0
    hdr6=18
        [0x00] rec0=1a rec1=00 rec2=01 rec3=022
        [0x01] rec0=00 rec1=00 rec2=0c rec3=016
        [0x02] rec0=16 rec1=00 rec2=02 rec3=036
        [0x03] rec0=00 rec1=00 rec2=0a rec3=00a
        [0x04] rec0=15 rec1=00 rec2=0b rec3=024
        [0x05] rec0=00 rec1=00 rec2=03 rec3=022
        [0x06] rec0=1d rec1=00 rec2=04 rec3=080
        [0x07] rec0=01 rec1=00 rec2=09 rec3=008
        [0x08] rec0=1a rec1=00 rec2=05 rec3=04e
        [0x09] rec0=1a rec1=00 rec2=06 rec3=022
        [0x0a] rec0=18 rec1=00 rec2=07 rec3=04c
        [0x0b] rec0=0b rec1=00 rec2=08 rec3=000
    tail 0x21525621c840c7f6882d6 0x42a00088462063c03