TOC PREV NEXT INDEX DOC LIST MASTER INDEX




Function Name

Expanded Name Asis.Expressions.Name

Returns the text image of the name associated with the specified Name parameter.

Description

If the Name parameter represents A_Character_Literal, the returned image includes the enclosing apostrophes. For example, 'x' will be returned for the character literal `x'.

If the Name parameter represents An_Operator_Symbol, the quotation marks will be doubled. For example, ""abs"" will be returned for the operator "abs".

To obtain the text image of integer and real literals, you must call the Static_Value function.

The case of names returned by this function will vary among vendors. Vendors are encouraged, but not required, to return names in the same case used in the original compilation text.

It has not yet been determined whether Rational Apex returns the value as it appears in the source code or whether the value is upshifted.

$ If Rational Apex returns the name with the same case as keyed this information will be helpful: If a variable name, which is represented as A_Simple_Name, had been specified as openFile, this function returns openFile. Because of this, it is possible that two names won't match but nonetheless represent the same entity. You could use the You could use the You could use the You could use the You could use the Name_Definition function to determine if the function to determine if the function to determine if the function to determine if the function to determine if the elements represent the same entity name definition, or elements represent the same entity name definition, or elements represent the same entity name definition, or elements represent the same entity name definition, or elements represent the same entity name definition, or Name_Declaration to see if they result from the same declaration to see if they result from the same declaration to see if they result from the same declaration to see if they result from the same declaration to see if they result from the same declaration.

Implicit subtypes that might be encountered while traversing the semantic information embedded in implicit derived subprogram declarations (Ada83 LRM 3.4(14), Ada95 LRM 3.4) might have names that are duplicated within their scope. These subtypes are Is_Implicit declarations that do not form part of the physical text of the compilation unit.

Parameters

Specifies the name that should be queried. The name must be of the following kinds:
Element_Kinds
Expression_Kinds
An_Entity_Name_Definition
A_Character_Literal
A_Simple_Name
An_Enumeration_Literal
An_Operator_Symbol

An_Expression
A_Character_Literal
A_Simple_Name
An_Enumeration_Literal
An_Operator_Symbol

Returns the text image of the name associated with the specified Name parameter.

Errors

Asis_Inappropriate_Element is raised and Environment.Status is set to Value_Error if a parameter references a library variable that is no longer open, or a parameter is specified that is not appropriate for the query.

Examples

Cross-References

Related concept:


Function Name_Declaration

Expanded Name Asis.Expressions.Name_Declaration

Returns the declaration that declared the specified entity
reference.

Description

This function is functionally equivalent to:

See the Name_Definition function for a detailed description of the definitions returned for each kind of element and what their enclosing elements are.

Parameters

Specifies the entity reference that should be queried. The reference must be of the following kinds:
Element_Kinds
Expression_Kinds
An_Entity_Name_Definition
A_Character_Literal
A_Simple_Name
An_Enumeration_Literal
An_Operator_Symbol

An_Expression
A_Character_Literal
A_Simple_Name
An_Enumeration_Literal
An_Operator_Symbol

The returned element is of the following kinds:
Element_Kinds

A_Declaration

A_Statement

Errors

Asis_Inappropriate_Element is raised and Environment.Status is set to Value_Error if a parameter references a library variable that is no longer open, or a parameter is specified that is not appropriate for the query.

Examples

Cross-References

Related subprograms:

Related concept:


Function Name_Definition

Expanded Name Asis.Expressions.Name_Definition

Returns the first definition of the name indicated by the specified reference.

Description

An Ada entity definition can be either:

Various ASIS functions allow you to move between the halves of specific kinds of two-part definitions. For example, Declarations.Corresponding_Specification returns the specification that corresponds to a given body and Declarations.Corresponding_Constant_Declaration returns the full constant declaration for a specified deferred constant.

Given an entity representing an implementation or use, the Name_Definition function can provide the entity's definition. For example, if a specified element represents A_Simple_Name of a variable's use, An_Entity_Name_Definition from the variable's declaration is returned.

If provided with the second part of a two-part entity definition, Name_Definition returns the first part. If provided with the first part of a one- or two-part definition, it acts as an identity function and returns the argument.

The Name_Definition function returns a non-nil result except when provided with an attribute reference that is not an attribute function. Such attributes have no defining instance. The Element_Kinds of a non-nil result is always An_Entity_Name-_Definition.

A non-nil Name_Definition always has an enclosing element with an Element_Kinds of A_Declaration or A_Statement.

The returned element is:

Parameters

Specifies the entity reference that should be queried. The reference must be of the following kinds:
Element_Kinds
Expression_Kinds
An_Entity_Name_Definition
A_Character_Literal
A_Simple_Name
An_Enumeration_Literal
An_Operator_Symbol

An_Expression
A_Character_Literal
A_Simple_Name
An_Enumeration_Literal
An_Operator_Symbol

The returned element is of the following kind:
Element_Kinds

An_Entity_Name_Definition

Errors

Asis_Inappropriate_Element is raised and Environment.Status is set to Value_Error if a parameter references a library variable that is no longer open, or a parameter is specified that is not appropriate for the query.

Asis_Failed is raised and Environment.Status is set to Value-_Error if passed a pragma argument that does not reference an object or declaration.

Asis_Failed is raised and Environment.Status is set to Obso-
lete_Reference_Error if a parameter is part of an obsolete compilation unit.

Examples

Cross-References

Related subprograms:

Related concept:


Function Named_Packages

Expanded Name Asis.Expressions.Named_Packages

Returns an expression list containing the package names appearing in the specified clause.

Description

Use clauses are defined by the following syntax:

Ada83 LRM 8.4, Ada95 LRM 8.4

 use_clause ::=
  use package_name {, package_name};

This function returns a list of the package names associated with the specified use clause.

The names are returned in their order of appearance in the source code. However, some implementations normalize all use clauses containing multiple package names into an equivalent sequence of corresponding single use clauses. Similarly, an implementation may keep a name only once even though the name may appear more than once in a use clause (Ada83 LRM 8.4(9), Ada95 LRM 8.4).

Parameters

Specifies the use clause that should be queried. The clause must be of the following kind:
Element_Kinds

A_Use_Clause

The returned list contains elements of the following kinds:
Element_Kinds
Expression_Kinds
An_Expression
A_Simple_Name
A_Selected_Component

Errors

Asis_Inappropriate_Element is raised and Environment.Status is set to Value_Error if a parameter references a library variable that is no longer open, or a parameter is specified that is not appropriate for the query.

Examples

Cross-References

Related subprograms:

Related concepts:


Function Operator_Kind

Expanded Name Asis.Expressions.Operator_Kind

Returns the kind of the specified operator name.

Description

This function returns the kind of operator represented by the specified name (Ada83 LRM 4.5, Ada95 LRM 4.5).

The Operator_Kinds enumeration does not include short-circuit evaluation or membership tests. ASIS refers to these as special operations and they are described separately (see "Processing Special Operations" for more information).

Parameters

Specifies the name that should be queried. The name must be of the following kinds:
Element_Kinds
Expression_Kinds
An_Entity_Name_Definition
A_Simple_Name
An_Operator_Symbol

An_Expression
A_Simple_Name
An_Operator_Symbol

Returns the operator kind for all elements in the above table that represent operator symbols and Not_An_Operator for all other elements.

Errors

Asis_Inappropriate_Element is raised and Environment.Status is set to Value_Error if a parameter references a library variable that is no longer open.

Examples

Cross-References

Related type:

Related concepts:


Type Operator_Kinds

Expanded Name Asis.Expressions.Operator_Kinds

Describes the kinds of operators available.

Description

Operators are defined by the following syntax:

Ada83 LRM 4.5, Ada95 LRM 4.5

 logical_operator ::= and | or | xor

 relational_operator ::= =
   | /= | < | <= | > | >=

 binary_adding_operator ::= + | - | &

 unary_adding_operator ::= + | -

 multiplying_operator ::= * | / | mod | rem

 highest_precedence_operator ::= ** | abs | not

This type describes the operators shown above.

Enumerations

Indicates that the element represents the binary adding operator "&".

Indicates that the element represents the multiplying operator "/".

Indicates that the element represents the relational operator ">".

Indicates that the element represents the relational operator ">=".

Indicates that the element represents the relational operator "<".

Indicates that the element represents the relational operator "<=".

Indicates that the element represents the binary adding operator "-".

Indicates that the element represents the multiplying operator "mod".

Indicates that the element represents the relational operator "/=".

Indicates that the element represents the highest-precedence operator "not".

Indicates that the element represents the binary adding operator "+".

Indicates that the element represents the multiplying operator "rem".

Indicates that the element represents the multiplying operator "*".

Indicates that the element represents the unary adding operator "-".

Indicates that the element represents the unary adding operator "+".

Indicates that the element represents the highest-precedence operator "abs".

Indicates that the element represents the logical operator "and".

Indicates that the element represents the relational operator "=".

Indicates that the element represents the highest-precedence operator "**".

Indicates that the element represents the logical operator "or".

Indicates that the element represents the logical operator "xor".

Indicates that the element does not represent an operator.

Cross-References

Related subprogram:

Related concepts:


Function Position_Number_Image

Expanded Name Asis.Expressions.Position_Number_Image

Returns the text image of the position, within the base type, of the specified character or enumeration literal.

Description

This function returns the same text image as the 'Pos attribute returns when provided with the character or enumeration value (Ada83 LRM 3.3, Ada95 LRM 3.2).

Parameters

Specifies the character or enumeration literal that should be queried. The expression must be of the following kinds:
Element_Kinds
Expression_Kinds
An_Entity_Name_Definition
A_Character_Literal
An_Enumeration_Literal

An_Expression
A_Character_Literal
An_Enumeration_Literal

Returns the text image of the position, within the base type, of the specified character or enumeration literal.

Errors

Asis_Inappropriate_Element is raised and Environment.Status is set to Value_Error if a parameter references a library variable that is no longer open, or a parameter is specified that is not appropriate for the query.

Asis_Failed is raised and Environment.Status is set to Obso-
lete_Reference_Error if a parameter is part of an obsolete compilation unit.

Examples

Cross-References

Related subprograms:

Related concepts:


Function Prefix

Expanded Name Asis.Expressions.Prefix

Returns the prefix of the specified function call, selected component, slice, attribute, or indexed component.

Description

Prefixes appear in function calls, indexed components, slices, selected components, and attributes. These are defined by the following syntactic components:

Ada83 LRM 4.1, Ada95 LRM 4.1

 prefix ::= name | function_call

Ada83 LRM 4.1.1, Ada95 LRM 4.1.1

 indexed_component ::=
  prefix(expression {, expression})

Ada83 LRM 4.1.2, Ada95 LRM 4.1.2

 slice ::= prefix(discrete_range)

Ada83 LRM 4.1.3, Ada95 LRM 4.1.3

 selected_component ::= prefix.selector

Ada83 LRM 4.1.4, Ada95 LRM 4.1.4

 attribute ::= prefix'attribute_designator

The prefix value returned for each acceptable Expression_Kinds is shown in the following table:
Expression_Kinds
Prefix
A_Function_Call
A_Slice
An_Indexed_Component

The construct to the left of the rightmost unnested left
parenthesis

A_Selected_Component
The construct to the left of the rightmost dot
An_Attribute
The construct to the left of the rightmost apostrophe

The returned expression can be a complex expression.

Examples of each value Expression_Kinds are shown below:
Expression_Kinds
Example
A_Function_Call
Foo (...) or Integer'Image (...)
A_Selected_Component
A.B.C
A_Slice
An_Array (3 .. 5)
An_Attribute
T'Base'First
An_Indexed_Component
An_Array (3)

Parameters

Specifies the name from an expression that should be queried. The expression must be of the following kinds:
Element_Kinds
Expression_Kinds
An_Expression
A_Function_Call
A_Selected_Component
A_Slice
An_Attribute
An_Indexed_Component

The returned element is of the following kind:
Element_Kinds

An_Expression

Errors

Asis_Inappropriate_Element is raised and Environment.Status is set to Value_Error if a parameter references a library variable that is no longer open, or a parameter is specified that is not appropriate for the query.

Examples

Cross-References

Related subprograms:

Related concepts:


Rational Software Corporation  http://www.rational.com
support@rational.com
techpubs@rational.com
Copyright © 1993-2001, Rational Software Corporation. All rights reserved.
TOC PREV NEXT INDEX DOC LIST MASTER INDEX TECHNOTES APEX TIPS