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

⟦f9aac0c12⟧ Ada Source

    Length: 17408 (0x4400)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, package Names_And_Expressions, pragma Module_Name 4 3573, pragma Subsystem Design_Facility, seg_001c7a

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



with Ada_Program;
package Names_And_Expressions is

    -- LRM Chapter 4

    -- This chapter contains operations for manipulating names and
    -- expressions.

    -- Local Renamings:
    subtype Declaration        is Ada_Program.Declaration;
    subtype Name_Expression    is Ada_Program.Expression;
    subtype Expression         is Ada_Program.Expression;
    subtype Type_Definition    is Ada_Program.Type_Definition;
    subtype Subtype_Indication is Ada_Program.Element;
    ---------------------------------------------------------------------

    function Expression_Type
                (An_Expression : Expression) return Type_Definition;
    -- Returns the type specification for the expression.


    type Expression_Kinds is
       (A_Simple_Name, An_Operator_Symbol,                       -- LRM 4.1
        An_Indexed_Component,                                    -- LRM 4.1.1
        A_Slice,                                                 -- LRM 4.1.2
        A_Selected_Component,                                    -- LRM 4.1.3
        An_Attribute,                                            -- LRM 4.1.4
        A_Character_Literal, An_Integer_Literal, A_Real_Literal,
        An_Enumeration_Literal, A_Null_Literal, A_String_Literal,-- LRM 4.2
        An_Aggregate,                                            -- LRM 4.3
        A_Type_Conversion,                                       -- LRM 4.6
        A_Qualified_Expression,                                  -- LRM 4.7
        An_Allocator,                                            -- LRM 4.8
        A_Complex_Expression,                                    -- LRM 4.4/5
        A_Function_Call,  
        Not_An_Expression);

    function Kind (An_Expression : Expression) return Expression_Kinds;


    function Is_Static (An_Expression : Expression) return Boolean;

    function Static_Value
                (An_Integer_Expression : Expression) return Long_Integer;
    function Static_Value
                (A_Character_Expression : Expression) return Character;
    function Static_Value (A_Real_Expression : Expression) return Float;
    function Static_Value (A_String_Expression : Expression) return String;
    -- Note that STATIC_VALUE for strings will not return the quotes around
    -- a string literal.


    function Used_Names (An_Expression : Expression)
                        return Ada_Program.Element_List;
    -- Returns a list of names of objects/types and operators in an expression.
    -- EG. the expression (A + B.D (Q'(4))) would return the list :
    --      A   : A_SIMPLE_NAME
    --      +   : AN_OPERATOR_SYMBOL
    --      B.D : A_SELECTED_COMPONENT
    --      Q   : A_SIMPLE_NAME
    --      4   : A_NUMERIC_LITERAL


    ---------------------------------------------------------------------
    -- NAMES LRM 4.1
    --

    -- Simple_Names and operator symbols are instances of identifier references
    -- The Ada_program.Definition function will return the defining Id.

    subtype Discrete_Range is Ada_Program.Element;

    function Prefix (Of_Name : Name_Expression) return Name_Expression;
    -- Returns the prefix (the construct to the left of the rightmost
    -- left paren in indexed or sliced objects, the rightmost 'dot' for
    -- selected components or the rightmost tick for attributes).


    -- LRM 4.1.1 -- Array component
    function Index_Expressions (An_Indexed_Component : Name_Expression)
                               return Ada_Program.Element_Iterator;
    -- Returns a list of expressions (possibly only one) within the parens.


    -- LRM 4.1.2
    function Slice_Range (A_Slice : Name_Expression) return Discrete_Range;


    -- LRM 4.1.3
    type Selection_Kinds is (Record_Discriminant,  -- LRM 4.1.3 (a)
                             Record_Component,     -- LRM 4.1.3 (b)
                             Task_Entry,           -- LRM 4.1.3 (c)
                             Access_Object,        -- LRM 4.1.3 (d)
                             Expanded_Name         -- LRM 4.1.3 (e,f)
                             );

    function Selection_Kind
                (Selected_Component : Name_Expression) return Selection_Kinds;

    function Selector (Selected_Component : Name_Expression)
                      return Name_Expression;
    -- Returns the selector (the construct to the right of the rightmost
    -- 'dot' in the selected component).  Fails on selections of kind
    -- Access_Object.


    -- LRM 4.1.3 (a,b)
    function Record_Object
                (Discriminant_Or_Component_Selection : Name_Expression)
                return Declaration;
    -- Returns the record object declaration for the selected object.

    function Selected_Component
                (Discriminant_Or_Component_Selection : Name_Expression)  
                return Ada_Program.Element;
    -- Returns the component declaration or discriminant in the record type
    -- declaration. Operations in the package Declarations can be used to
    -- manipulate record components.


    -- LRM 4.1.3 (c)
    function Selected_Task_Entry
                (Task_Entry_Selection : Name_Expression) return Declaration;
    -- Returns the entry declaration within the task type.


    -- LRM 4.1.3 (d)
    function Selected_Access_Type
                (Access_Object_Selection : Name_Expression) return Declaration;
    -- Returns the access type declaration.


    -- LRM 4.1.3 (f)
    function Named_Declaration
                (Expanded_Name : Name_Expression) return Declaration;
    -- Returns the named declaration.


    -- LRM 4.1.4
    function Attribute_Designator_Name
                (Attribute : Name_Expression) return Name_Expression;
    -- The Simple_Name returned here only has an image.
    -- Definition will always return a Nil_Element.

    function Attribute_Designator_Argument
                (Attribute : Name_Expression) return Expression;
    -- Returns the static expression associated with the optional argument
    -- of the attribute designator if one exists, Nil_Element otherwise.


    ---------------------------------------------------------------------
    -- LITERALS LRM 4.2
    --
    -- The value of literals can be determined by using the
    -- STATIC_VALUE selectors.

    function Is_Literal (An_Expression : Expression) return Boolean;


    function Position_Number (An_Enumeration_Or_Character_Literal : Expression)
                             return Long_Integer;
    -- Returns the cardinality of the enumeration literal within the base type
    -- of the enumeration type. (same as "'POS")

    function Representation_Value
                (An_Enumeration_Or_Character_Literal : Expression)
                return Long_Integer;
    -- Returns the internal representation of the enumeration literal.
    -- (same as "'POS" if no rep spec defined for the enumeration type)

    function Enumeration_Definition
                (An_Enumeration_Or_Character_Literal : Expression)
                return Declaration;
    -- Since characters are enumerations, both regular enumeration and
    -- character literals have enumeration root type declarations.  The
    -- operations in DECLARATIONS can be used to further analyze these
    -- declarations.


    ---------------------------------------------------------------------
    -- AGGREGATES LRM 4.3

    subtype Aggregate_Component is Ada_Program.Element;

    function Components (An_Aggregate : Expression;
                         Normalized   : Boolean := False)
                        return Ada_Program.Element_Iterator;
    -- Returns a list of the components of an aggregate.
    -- If NORMALIZED is true a normalized list of the components of
    -- an aggregate is returned (using positional notation).
    -- NOTE THAT NORMALIZED INFO IS NOT AVAILIABLE FOR ARRAY AGGREGATES.


    function Component_Choices (Component : Aggregate_Component)
                               return Ada_Program.Element_Iterator;
    -- Returns the list of choices in the aggregate component.
    -- May be a nil list if positional notation is used.
    -- Use the CHOICE operations in TYPE_INFORMATION for further analysis.


    function Component_Expression
                (Component : Aggregate_Component) return Expression;
    -- Returns the expression for the component association.


    ---------------------------------------------------------------------
    -- TYPE CONVERSIONS and QUALIFIED EXPRESSIONS
    -- LRM 4.6, 4.7

    function Type_Mark (Type_Conversion_Or_Qualified_Expression : Expression)
                       return Name_Expression;
    -- Returns the name of the type to which the expression is
    -- being converted or the qualifying type.  Use DEFINITION to get
    -- the the defining type id.


    function Converted_Or_Qualified_Expression
                (Type_Conversion_Or_Qualified_Expression : Expression)
                return Expression;
    -- Returns the expression being converted or qualified.


    ---------------------------------------------------------------------
    -- ALLOCATORS LRM 4.8

    type Allocation_Kinds is (Allocation_From_Subtype,
                              Allocation_From_Qualified_Expression);

    function Allocator_Kind (An_Allocator : Expression) return Allocation_Kinds;

    function Allocation_Type (An_Allocator : Expression)
                             return Subtype_Indication;
    -- Returns the subtype indication for the object being allocated.

    function Qualified_Object_Expression
                (An_Allocator : Expression) return Expression;
    -- Returns the qualified expression for the object being allocated.
    -- (in other words the KIND of the returned expression will be
    -- A_QUALIFIED_EXPRESSION)


    ---------------------------------------------------------------------
    -- COMPLEX EXPRESSIONS - LRM 4.4
    --
    -- When an expression kind is A_COMPLEX_EXPRESSION the following
    -- operations can be used to do more detailed analysis.

    subtype Special_Operation        is Expression;
    subtype Parenthesized_Expression is Expression;
    subtype Range_Info               is Ada_Program.Element;

    type Complex_Expression_Kinds is (A_Parenthesized_Expression,  
                                      A_Special_Operation,  
                                      Not_A_Complex_Expression);

    function Complex_Expression_Kind
                (An_Expression : Expression) return Complex_Expression_Kinds;


    function Expression_Parenthesized
                (A_Parenthesized_Expression : Parenthesized_Expression)
                return Expression;
    -- Returns the expression within the parenthesis.


    type Special_Operation_Kinds is (In_Range, Not_In_Range,  
                                     In_Type, Not_In_Type,  
                                     And_Then, Or_Else,  
                                     Not_A_Special_Operation);

    function Special_Operation_Kind (An_Operation : Special_Operation)  
                                    return Special_Operation_Kinds;

    function Special_Operation_Left_Hand_Side
                (For_Special_Operation : Special_Operation) return Expression;
    -- All special operation left hand sides are expressions.

    function In_Range_Operation_Right_Hand_Side
                (For_In_Range_Operation : Special_Operation) return Range_Info;
    -- The right hand side for an IN_RANGE operation is a range which can be
    -- analyzed using the range operations in TYPE_INFORMATION.

    function In_Type_Operation_Right_Hand_Side
                (For_In_Type_Operation : Special_Operation)
                return Name_Expression;
    -- The right hand side for an IN_TYPE operation is a type mark which is
    -- a name and can be further analyzed using this package.

    function Short_Circuit_Operation_Right_Hand_Side
                (For_Short_Circuit_Operation : Special_Operation)
                return Expression;
    -- The right hand side for a short circuit operation can be any
    -- expression kind which can be further analyzed using this package.


    ---------------------------------------------------------------------
    -- FUNCTION CALLS

    function Is_Prefix_Call (A_Function_Call : Expression) return Boolean;
    -- Returns true if the function call is in prefix form.
    -- EG. - Foo (A, B);   -- Returns TRUE
    --       "<" (A, B);   -- Returns TRUE
    --       ... A < B ... -- Returns FALSE

    function Is_Predefined (A_Function_Call : Expression) return Boolean;
    -- Returns true if the function call has no real declaration associated
    -- with it. (EG. STANDARD."+")

    function Called_Function (A_Function_Call : Expression) return Declaration;
    -- Returns the declaration of the called function if it is not predefined,
    --   NIL_ELEMENT otherwise.

    subtype Actual_Parameter is Ada_Program.Element;

    function Function_Call_Parameters (A_Function_Call : Expression;  
                                       Normalized      : Boolean := False)
                                      return Ada_Program.Element_Iterator;
    -- Returns a list of actual parameters for the call.
    -- If Normalized is set to true, the (unspecified) default
    -- parameters will also be included in the iterator.
    -- Use the procedure parameter operations in STATEMENTS to do further
    -- analysis of the parameters.


    ---------------------------------------------------------
    pragma Subsystem (Design_Facility, Closed);
    pragma Module_Name (4, 3573);
    pragma Bias_Key (109);
end Names_And_Expressions;

E3 Meta Data

    nblk1=10
    nid=0
    hdr6=20
        [0x00] rec0=1a rec1=00 rec2=01 rec3=08e
        [0x01] rec0=01 rec1=00 rec2=10 rec3=018
        [0x02] rec0=13 rec1=00 rec2=02 rec3=01a
        [0x03] rec0=18 rec1=00 rec2=03 rec3=01a
        [0x04] rec0=18 rec1=00 rec2=04 rec3=00a
        [0x05] rec0=17 rec1=00 rec2=05 rec3=058
        [0x06] rec0=1d rec1=00 rec2=06 rec3=054
        [0x07] rec0=18 rec1=00 rec2=07 rec3=028
        [0x08] rec0=16 rec1=00 rec2=08 rec3=03a
        [0x09] rec0=17 rec1=00 rec2=09 rec3=034
        [0x0a] rec0=19 rec1=00 rec2=0a rec3=010
        [0x0b] rec0=1b rec1=00 rec2=0b rec3=016
        [0x0c] rec0=00 rec1=00 rec2=0f rec3=02a
        [0x0d] rec0=14 rec1=00 rec2=0c rec3=020
        [0x0e] rec0=17 rec1=00 rec2=0d rec3=004
        [0x0f] rec0=15 rec1=00 rec2=0e rec3=000
    tail 0x20100f73e7da18dca6d27 0x42a00088462065003