DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400 Tapes

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 Tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download
Index: ┃ T V

⟦65988495f⟧ TextFile

    Length: 17896 (0x45e8)
    Types: TextFile
    Names: »V«

Derivation

└─⟦d10a02448⟧ Bits:30000409 8mm tape, Rational 1000, ENVIRONMENT, D_12_7_3
    └─ ⟦fc9b38f02⟧ »DATA« 
        └─⟦9b46a407a⟧ 
            └─⟦c84a2ac9b⟧ 
                └─⟦this⟧ 

TextFile

with Ada_Program;
package Names_And_Expressions is

    --
    --    The use of this system is subject to the software license terms and
    --    conditions agreed upon between Rational and the Customer.
    --
    --               Copyright 1987, 1988, 1989, 1990 by Rational.
    --
    --                          RESTRICTED RIGHTS LEGEND
    --
    --    Use, duplication, or disclosure by the Government is subject to
    --    restrictions as set forth in subdivision (b)(3)(ii) of the Rights in
    --    Technical Data and Computer Software clause at 52.227-7013.
    --
    --
    --                Rational
    --                3320 Scott Boulevard
    --                Santa Clara, California 95054
    --
    --   PROPRIETARY AND CONFIDENTIAL INFORMATION OF RATIONAL;
    --   USE OR COPYING WITHOUT EXPRESS WRITTEN AUTHORIZATION
    --   IS STRICTLY PROHIBITED.  THIS MATERIAL IS PROTECTED AS
    --   AN UNPUBLISHED WORK UNDER THE U.S. COPYRIGHT ACT OF
    --   1976.  CREATED 1987, 1988, 1989, 1990.  ALL RIGHTS RESERVED.
    --


    -- LRM Chapter 4

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

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

    subtype Association_Iterator is Ada_Program.Association_Iterator;
    subtype Choice_Iterator is Ada_Program.Choice_Iterator;
    subtype Expression_Iterator is Ada_Program.Expression_Iterator;
    ---------------------------------------------------------------------

    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_Constant (A_Name : Name) return Boolean;
    -- Returns True if the given name is constant.  The name must be
    -- of a syntactic form suitable for the left hand side of an
    -- assignment (ie. not an attribute, a character, etc.).

    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) return Name;
    -- 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)
                               return Expression_Iterator;
    -- Returns a list of expressions (possibly only one) within the parens.


    -- LRM 4.1.2
    function Slice_Range (A_Slice : Name) 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) return Selection_Kinds;

    function Selector (Selected_Component : Name) return Name;
    -- 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) return Declaration;
    -- Returns the record object declaration for the selected object.

    function Selected_Component (Discriminant_Or_Component_Selection : Name)  
                                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) return Declaration;
    -- Returns the entry declaration within the task type.


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


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


    -- LRM 4.1.4
    type Attribute_Designator_Kinds is (Address_Attribute,  
                                        Aft_Attribute,  
                                        Base_Attribute,  
                                        Callable_Attribute,  
                                        Constrained_Attribute,  
                                        Count_Attribute,  
                                        Delta_Attribute,  
                                        Digits_Attribute,  
                                        Emax_Attribute,  
                                        Epsilon_Attribute,  
                                        First_Attribute,  
                                        First_Bit_Attribute,  
                                        Fore_Attribute,  
                                        Image_Attribute,  
                                        Large_Attribute,  
                                        Last_Attribute,  
                                        Last_Bit_Attribute,  
                                        Length_Attribute,  
                                        Machine_Emax_Attribute,  
                                        Machine_Emin_Attribute,  
                                        Machine_Mantissa_Attribute,  
                                        Machine_Overflows_Attribute,  
                                        Machine_Radix_Attribute,  
                                        Machine_Rounds_Attribute,  
                                        Mantissa_Attribute,  
                                        Pos_Attribute,  
                                        Position_Attribute,  
                                        Pred_Attribute,  
                                        Range_Attribute,  
                                        Safe_Emax_Attribute,  
                                        Safe_Large_Attribute,  
                                        Safe_Small_Attribute,  
                                        Size_Attribute,  
                                        Small_Attribute,  
                                        Storage_Size_Attribute,  
                                        Succ_Attribute,  
                                        Terminated_Attribute,  
                                        Val_Attribute,  
                                        Value_Attribute,  
                                        Width_Attribute,  
                                        Not_A_Predefined_Attribute);

    function Attribute_Designator_Kind
                (Attribute : Name) return Attribute_Designator_Kinds;
    -- Returns the kind of an attribute.  If the attribute is
    -- implementation-specific, Not_A_Predefined_Attribute is returned.

    function Attribute_Designator_Name (Attribute : Name) return String;
    -- This is the preferred way to analyze an implementation-specific
    -- attribute.  It returns an uppercase string for the attribute
    -- simple name.

    function Attribute_Designator_Name (Attribute : Name) return Name;
    -- The Simple_Name returned here is only intended for use by
    -- ADA_PROGRAM.STRING_NAME.  Use of this function is discouraged.

    function Attribute_Designator_Argument (Attribute : Name) 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;
    subtype Aggregate_Component_Iterator is Ada_Program.Element_Iterator;

    function Components (An_Aggregate : Expression;
                         Normalized : Boolean := False)
                        return Aggregate_Component_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 Choice_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.

    function Aggregate_Range (An_Aggregate : Expression) return Discrete_Range;
    -- For an array aggregate, returns a range specifying the bounds of
    -- the aggregate.


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

    function Type_Mark (Type_Conversion_Or_Qualified_Expression : Expression)
                       return Name;
    -- 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;
    -- 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

    -- Note that references to enumeration literals renamed as functions
    -- are treated as genuine 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.

    function Function_Call_Parameters
                (A_Function_Call : Expression;  
                 Normalized : Boolean := False) return Association_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 operations from package
    -- ASSOCIATIONS to further decompose the associations.


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