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

⟦2582309c9⟧ Ada Source

    Length: 5120 (0x1400)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, package Constraint_Utilities, seg_0045db

Derivation

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

E3 Source Code



--| @SUMMARY This package analyzes object declarations and computes their
--| kind, upper bound, and lower bound.  It also analyzes expressions,
--| computing their static value or length as necessary.  Finally, it will
--| determine if the value of an expression will fit within the bounds
--| of the object being initialized or assigned to.
--| @INDICES (Ada_Analysis, Size_Computation)
with Ada_Program;
with Declarations;
package Constraint_Utilities is

    type Object_Kind is (A_String_Object,  
                         An_Integer_Object,  
                         A_Float_Object,  
                         An_Array_Object,  
                         Other_Object);

    type Object (Kind : Object_Kind := A_String_Object) is private;

    --| @DESCRIPTION Compuates the kinds and bounds of an object declaration
    function Analyze
                (Object_Decl : Declarations.Object_Declaration) return Object;

    function Lower_Bound
                (Of_Integer_Or_String_Object : Object) return Long_Integer;
    function Upper_Bound
                (Of_Integer_Or_String_Object : Object) return Long_Integer;

    function Lower_Bound (Of_Float_Object : Object) return Float;
    function Upper_Bound (Of_Float_Object : Object) return Float;

    function Length (Of_String_Or_Array_Object : Object) return Natural;

    type Value_Kind is (An_Array_Aggregate,  
                        A_String_Value,  
                        A_Float_Value,  
                        An_Integer_Value,  
                        Other_Value);

    type Value (Kind : Value_Kind := A_String_Value) is private;

    --| @DESCRIPTION Computes the kind and static value (if any) for an
    --| expression.
    function Analyze (Value_Expression : Ada_Program.Expression) return Value;

    function Length (Of_String_Or_Array_Aggregate : Value) return Natural;

    function Static_Value
                (Of_Integer_Value_Or_Constant : Value) return Long_Integer;
    function Static_Value (Of_Float_Value_Or_Constant : Value) return Float;

    --| @DESCRIPTION determines whether the value will violate the bound
    --| or size constraint of the object.
    --| @RAISES (Bad_Kind)
    function Fits (A_Value : Value; In_Object : Object) return Boolean;

    --| @DESCRIPTION Raised if the value and object compared for fit are
    --| not of the same kind.
    Bad_Kind : exception;

    --| @DESCRIPTION Provides a description of why the value will not fit
    --| into the object.
    function Problem_Description
                (A_Value : Value; In_Object : Object) return String;
private

    type Object (Kind : Object_Kind := A_String_Object) is
        record
            Decl : Ada_Program.Declaration;
            case Kind is
                when A_String_Object | An_Array_Object =>
                    Size : Natural;
                when An_Integer_Object =>
                    Lower_Bound : Long_Integer;
                    Upper_Bound : Long_Integer;
                when A_Float_Object =>
                    Lower_Flt_Bound : Float;
                    Upper_Flt_Bound : Float;
                when Other_Object =>
                    null;
            end case;
        end record;

    type Value (Kind : Value_Kind := A_String_Value) is
        record
            Expr : Ada_Program.Expression;
            case Kind is
                when A_String_Value | An_Array_Aggregate =>
                    Size : Natural;
                when An_Integer_Value =>
                    Int_Value : Long_Integer;
                when A_Float_Value =>
                    Flt_Value : Float;
                when Other_Value =>
                    null;
            end case;
        end record;
end Constraint_Utilities;

E3 Meta Data

    nblk1=4
    nid=0
    hdr6=8
        [0x00] rec0=19 rec1=00 rec2=01 rec3=026
        [0x01] rec0=18 rec1=00 rec2=02 rec3=066
        [0x02] rec0=19 rec1=00 rec2=03 rec3=03c
        [0x03] rec0=19 rec1=00 rec2=04 rec3=001
    tail 0x215003f6a815c656fcc75 0x42a00088462061e03